KABUL - Medical aid group Medecins Sans Frontieres denied that Taliban fighters were firing from its hospital at Afghan and Nato forces before a US air strikekilled at least 19 people in a battle to oust the Islamist insurgents from an Afghan city.

Fighting raged around the northern provincial capital of Kunduz for a seventh day as government forces backed by American air power seek to drive out Taliban militants who seized the city almost a week ago.

Decomposing bodies littered the streets and residents said that food was scarce. MSF has said an airstrike carried out by US-led coalition forces, killed 19 staff and patients on Saturday in a hospital it runs in Kunduz, leaving 37 wounded.

The US military said it conducted an airstrike "in the vicinity" of the hospital, as it targeted Taliban insurgents who were directly firing on US military personnel.

President Barack Obama said the defense department had ordered a full investigation into the incident as the UN human rights chief said the assault on the hospital was "utterly tragic, inexcusable" and could amount to a war crime.

Medical charity also said it has withdrawn staff from the embattled city of Kunduz. It is the only medical facility in the whole northeastern 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 is working in our hospital," Kate Stegeman, a spokeswoman for the charity, told AFP. "I can't confirm at this stage whether our Kunduz trauma centre will reopen or not."

The bombing deals a blow to Afghan President Ashraf Ghani's policy of forging closer ties with the United States after his predecessor Hamid Karzai fell out with his backers in Washington in part over the number of civilians killed by bombs.

But the medical aid group Medecins Sans Frontieres also demanded that an independent international body investigate the air strike.

An official said the group could not rely on a US military probe that has been launched into the destruction of the hospital during fighting in the northern city of Kunduz. "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," MSF General Director Christopher Stokes said in a statement. "Relying only on an internal investigation by a party to the conflict would be wholly insufficient," his statement added.

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 after the Taliban's biggest victory in the nearly 14-year-old war.

In a statement, Obama offered condolences to the victims of what he called "the tragic incident". In Kabul, the Afghan Ministry of Defence said Taliban fighters had attacked the hospital and were using the building "as a human shield".

But the medical aid group denied this. "The gates of the hospital compound were closed all night so no one that is not staff, a patient or a caretaker was inside the hospital when the bombing happened," Medecins Sans Frontieres said in a statement on Sunday. "In any case, bombing a fully functioning hospital can never be justified."

Witnesses said patients were burned alive in the crowded hospital after the airstrike. Among the dead were three children being treated there.

The MSF hospital that was a lifeline for thousands in the city said it was pulling most of its staff out of the area because the hospital was no longer functioning. Some staff had gone to help treat the wounded at other hospitals outside of Kunduz. The struggle to retake Kunduz has raised questions over whether Nato-trained Afghan forces were ready to go it alone now most foreign combat troops have left.

Afghan security forces were conducting house-to-house searches on Sunday, as gunbattles persisted in parts of the city, said Hamdullah Danishi, acting governor of Kunduz province. He said 480 Taliban fighters and 35 soldiers had been killed. The army raised the national flag in the central square, an area of the city that has changed hands several times in the fighting during the last week.

"Our security forces took control of strategic areas in Kunduz," Danishi said. "We have a clearance operation ongoing." Afghan military helicopters on Sunday dropped 6,000 leaflets urging people to cooperate with the army, the defence ministry said.

"If you see abandoned military vehicles or equipment anywhere turn them over to security forces," the leaflets read. Corpses lay in the streets and people were too afraid to leave their homes, said one resident, Gulboddin. "You can hear the sound of gunfire all over the city," said Gulboddin, who has only one name. "Some of the bodies are decomposing."