The deadly air strike that hit a hospital in the Afghan city of  Kunduz was a mistake made within the US chain of command, the American commander of international forces in Afghanistan said today.

Army General John Campbell also made clear he favoured a plan to withdraw almost all US troops by the end of next year.

He said rising threats in Afghanistan from the Islamic State and al-Qaeda were among factors informing his recommendations to the White House on future troop levels.

Saturday's strike on an Afghan hospital run by Médecins Sans Frontières killed 22 people and deeply angered the medical charity.

MSF officials have blamed the US, demanding an independent investigation into the incident and calling it a war crime.

Mr Campbell said US forces had responded to a request from Afghan forces and provided close air support as they engaged in a fight with Taliban militants in Kunduz, a provincial capital that the Taliban captured late last month.

"To be clear, the decision to provide aerial fires was a US decision made within the US chain of command," Mr Campbell said in testimony to the Senate Armed Services Committee.

He added that US special forces nearby were communicating with the aircraft that delivered the strikes.

"A hospital was mistakenly struck," Mr Campbell said. "We would never intentionally target a protected medical facility."

Mr Campbell's comments were the most direct acknowledgement yet by the US government that the strike on the hospital was carried out by US forces.

"To be clear, the decision to provide aerial fires was a US decision made within the US chain of command," Mr Campbell said in testimony to the Senate Armed Services Committee.

He added that US special forces nearby were communicating with the aircraft that delivered the strikes.

"A hospital was mistakenly struck," Mr Campbell said. "We would never intentionally target a protected medical facility."

Mr Campbell's comments were the most direct acknowledgement yet by the US government that the strike on the hospital was carried out by US forces.