The top commander of US and coalition forces has said Afghan troops requested an airstrike which hit a hospital in Kunduz, killing 22 people.

General John Campbell, speaking at the Pentagon, said he was correcting an initial statement which said the airstrike had been employed to defend US forces who had come under fire from the Taliban.

He said the Afghan military advised US special operations forces on the ground that they needed air support.

"An airstrike was then called to eliminate the Taliban threat and several civilians were accidentally struck," he said.

"This is different from the initial reports which indicated that the US forces were threatened and the airstrike was called on their behalf.

White House spokesman Josh Earnest on Monday called the incident a "profound tragedy", adding that the US goes to great lengths to avoid civilian casualties.

Gen Campbell said if any errors occurred "we will hold those responsible accountable and we will take steps to ensure mistakes are not repeated".

He did not clarify whether the clinic was targeted in error, or whether other mistakes may have been made by US forces.

He said Taliban forces were remaining in the city, putting civilians in harm's way.

Nine aid workers were among the 22 people killed when the airstrike hit the hospital .

Medecins Sans Frontieres (MSF) said it had withdrawn from Kunduz after the hospital was badly damaged.

It said the hospital was hit despite the fact it had informed US, NATO and Afghan forces of its location a number of times to avoid being hit in the crossfire.

The US military has launched an investigation into the tragedy, with President Barack Obama also offering his "deepest condolences" to those killed and wounded.