Washington: General John F. Campbell, the commander of US and allied forces in Afghanistan, told lawmakers on Tuesday that the American air attack that killed at least 22 people at a hospital in northern Afghanistan was not intended to hit medical staff or patients.

“A hospital was mistakenly struck,” Campbell said in testimony before the Senate Armed Services Committee. “We would never intentionally target a protected medical facility.”

To prevent similar incidents in the future, Campbell said his forces would undergo “in-depth training” to review rules of engagement governing the current mission in Afghanistan.

Campbell said a full accounting of the weekend incident, which occurred as US forces sought to support an Afghan government attempt to reclaim the city of Kunduz, the first major Afghan city to fall to the Taliban since the war began in 2001, would be available after a Pentagon investigation. He declined to give a timeline for that probe.

Speaking a day earlier, Campbell said the attack, which took place under confused circumstances in the middle of the night on Saturday, was authorised after Afghan troops requested air support from American forces. That contradicted earlier statements from Pentagon officials that the strike was ordered to protect US forces on the ground.

The evolving account of what exactly happened has heightened the controversy over the strike, which relief group Doctors Without Borders has labelled the incident a deliberate attack and a possible war crime. Twelve of the group’s staff were killed in the attack.

The weekend’s disastrous air strike reinforces doubts about how effectively a limited US force in Afghanistan can work with Afghan troops to repel the Taliban, which has been newly emboldened as the United States draws down its presence.

The strike also comes as the Obama administration is weighing whether to keep as many as 5,000 US troops in Afghanistan beyond 2015. Obama has not made a final decision on the proposal, but the recent advances by the Taliban have certainly complicated the president’s calculus.

On Monday, Campbell told reporters at the Pentagon that Afghan forces “advised that they were taking fire from enemy positions and asked for air support from US forces.” Campbell made it clear that this differed from initial reports that said US forces were under attack and called in the air strikes for their defence.

Campbell’s remarks differed from two previous comments, including one made by Secretary of Defence Ashton B. Carter on Sunday that said US forces were under attack.

“At some point in the course of the events there [they] did report that they, themselves, were coming under attack. That much I think we can safely say,” Carter told reporters on Sunday.

Abdul Qahar Aram, spokesman for the Afghan army’s 209th Corps in northern Afghanistan, said he could not comment on the specifics of Saturday’s hospital bombing. But Aram said there was a “strong possibility” that Afghan forces had requested it.

One aspect of the strike that remained unclear on Monday was the exact role played by US forces accompanying the Afghans that night.

After Kunduz was overrun with Taliban fighters late last month, American Special Operations forces were ferried in to shore up Afghan forces that were making little headway in the fight to retake the populated city centre. Together, the US and Afghan forces have been able to retake nearly all of the city.

These “train, advise and assist” missions are a staple of US Special Forces capabilities and have been conducted extensively in recent years. In combat situations, rather than return fire, US troops on these missions are more likely to help direct communication, casualty evacuation and direct air support from an AC-130, for instance, if it is available.

As a result, there has been little direct contact between US troops and the Taliban since most US forces were relegated to the sidelines when official combat operations ended last year.

The aircraft that carried out the weekend attack was an AC-130 gunship, according to Campbell. Unlike jets, the AC-130 is a unique aircraft dedicated almost entirely to supporting Special Operations forces.

In order to make sure targeting and communication from the ground to the aircraft is as seamless as possible, every AC-130 flies with a liaison officer who has spent time as a Special Forces soldier on the ground.

While most jets streak across a target, moving quickly while dropping bombs or firing cannons or machine guns, the AC-130 essentially loiters over a target at around 7,000 feet (2,133 metres) flying in a circle and firing from weapons ports mounted on the aircraft’s left side.

Unlike other military fixed-wing aircraft, an AC-130 is requested differently. While a jet requires a map coordinate to engage its target, the AC-130 relies on direction (a compass heading) and a distance to the enemy target from the friendly forces engaged on the ground. In short, it relies on visual targeting.

This difference might explain why the hospital was targeted even though Doctors Without Borders said it had given US and Afghan forces its map coordinates before.

“It’s a visual acuity aircraft,” said a US close-air support pilot who spoke on the condition of anonymity because of his active-duty status. “An AC-130 finds the friendly force, then fires over their left or right shoulder.”

The pilot went on to add that an AC-130 does not enter enemy airspace and look for targets. It specifically has to be guided onto the target by a force on the ground and will fire only after identifying friendly and enemy forces, he said.