Medical aid group Medecins Sans Frontieres (MSF) has demanded an independent international inquiry into a suspected US air strike that killed 22 people in one of its Afghan hospitals, branding the attack a "war crime".

The group, also known as Doctors Without Borders, said patients burned to death in their beds during a bombing raid that continued for half an hour after US and Afghan authorities were informed the hospital had been had been hit.

MSF said a US military probe into the incident, which occurred during a push by Afghan security forces to retake the key northern city of Kunduz from Taliban insurgents, was not enough.

Key points: At least 22 people killed in strike on hospital run by MSF

At least 22 people killed in strike on hospital run by MSF US promises investigation, does not admit being behind strike

US promises investigation, does not admit being behind strike MSF calls for independent inquiry into "war crime", pulls most staff out of the area

"Relying only on an internal investigation by a party to the conflict would be wholly insufficient," MSF general director Christopher Stokes said in a statement.

"Under the clear presumption that a war crime has been committed, MSF demands that a full and transparent investigation into the event be conducted by an independent international body."

Battles were still raging around Kunduz, a city of 300,000, as government forces backed by US air power sought to drive out Taliban militants who seized the city almost a week ago in one of their biggest victories in the 14-year war.

Decomposing bodies littered the streets and trapped residents said that food was running scarce.

Any confirmation of US responsibility for the hospital deaths would deal a blow to Afghan president Ashraf Ghani's policy of forging closer ties with the US. His predecessor Hamid Karzai fell out with his backers in Washington in part over the number of civilians killed by US strikes.

But the Afghan leader will be torn between distancing himself from Washington and the need for American firepower to help his forces drive insurgents out of Kunduz.

The US military said it conducted an air strike "in the vicinity" of the MSF hospital as it targeted Taliban insurgents who were directly firing on US military personnel. It has not acknowledged hitting the hospital.

US president Barack Obama offered condolences to the victims of what he called "the tragic incident".

UN rights chief Zeid Ra'ad Al Hussein said the hospital assault was "inexcusable" and also said it could amount to a war crime.

"This event is utterly tragic, inexcusable and possibly even criminal," he said.

The US-led coalition force in Afghanistan said it expected to complete its preliminary multi-national investigation within days.

In Kabul, the Ministry of Defence said Taliban fighters had attacked the hospital and were using the building "as a human shield". But MSF denied this.

"Not a single member of our staff reported any fighting inside the MSF hospital compound prior to the US air strike on Saturday morning," Mr Stokes said.

'Patients burned to death as they lay in their beds'

Doctors Without Borders staff in shock after their hospital is bombed in Kunduz, Afghanistan. ( Twitter: Medecins Sans Frontieres UK )

MSF said some 105 patients and their caregivers, as well as more than 80 international and local MSF staff, were in the hospital at the time of the bombing.

"The bombs hit and then we heard the plane circle round," said Heman Nagarathnam, MSF's head of program in northern Afghanistan.

"There was a pause, and then more bombs hit. This happened again and again. When I made it out from the office, the main hospital building was engulfed in flames.

Loading

"Those people that could had moved quickly to the building's two bunkers to seek safety. But patients who were unable to escape burned to death as they lay in their beds."

The hospital's main building was completely gutted and some bodies of those trapped inside were charred beyond recognition.

The dead included 12 MSF staff and 10 patients, among them three children.

In the wake of the bombing, MSF said it had shut down operations in Kunduz. Some staff had gone to help treat the wounded at other hospitals outside of the city.

The hospital is the only medical facility in the whole north-eastern region of Afghanistan that can deal with major war injuries. Its closure, even temporarily, could have a devastating impact on local civilians.

"The MSF hospital is not functional anymore. All critical patients have been referred to other health facilities and no MSF staff are working in our hospital," Kate Stegeman, a spokeswoman for the charity, told AFP.

Ms Stegeman said she could not confirm whether the trauma centre would reopen.

AFP/Reuters