An airstrike hit a hospital run by Medecins Sans Frontieres in the Afghan city of Kunduz on Saturday, killing at least 16 people in what the US military called possible "collateral damage" in the battle to oust Taliban insurgents.
Frantic MSF staff phoned military officials at NATO in Kabul and Washington after the attack, and bombs continued to rain down near the medical facility for nearly an hour, one official from the aid group said.
At least 37 people were wounded and many patients and staff still missing, it added.
The US military promised to investigate the incident, which could renew concerns over the use of its air power in the conflict.
Afghan government forces backed by US air power have fought to drive the Taliban out of the northern provincial capital since the militants seized it six days ago, in the biggest victory of their near 14-year insurgency.
One resident, Khodaidad, told Reuters the Taliban had been using the hospital buildings for cover during the fighting on Friday.
"I could hear sounds of heavy gunfire, explosions and airplanes throughout the night," he added. "There were several huge explosions and it sounded like the roof was falling on me," he added.
US forces launched an air strike at 2.15 a.m. (2145 GMT), spokesman, Col. Brian Tribus, said in a statement.
"The strike may have resulted in collateral damage to a nearby medical facility ... This incident is under investigation," he added.
At the aid group's bombed-out hospital, one wall of a building had collapsed, scattering fragments of glass and wooden door frames, and three rooms were ablaze, said Saad Mukhtar, director of public health in Kunduz.
"Thick black smoke could be seen rising from some of the rooms ... The fighting is still going on, so we had to leave."
Almost 200 patients and employees were in the hospital, the only one in the region that can deal with major injuries, said Medecins Sans Frontieres, which raised the death toll to at least 16 by late on Saturday.
"We are deeply shocked by the attack, the killing of our staff and patients and the heavy toll it has inflicted on healthcare in Kunduz," operations director Bart Janssens said in a statement.
MSF said it gave the location of the hospital to both Afghan and US forces several times in the past few months, most recently this week, to avoid being caught in crossfire.
MSF said it had treated almost 400 patients in the 150-bed hospital since fighting broke out, most for gunshot wounds. So many patients have flooded in that the hospital had to put them in offices and on mattresses on the floor.
Afghan President Ashraf Ghani's spokesman said last week there would be no airstrikes inside the city because of the risk of mass civilian casualties.
Ghani's predecessor, former President Hamid Karzai, fell out with his backers in Washington in part over the number of civilians killed by bombs earlier in the nearly 14-year-old war, America's longest military conflict.
The US embassy in Kabul said in a statement it "mourns for the individuals and families affected by the tragic incident".
The International Committee of the Red Cross said it was "deeply shocked" by the incident.
"This is an appalling tragedy," said Jean-Nicolas Marti, head of the ICRC in Afghanistan. "Such attacks undermine the capacity of humanitarian organisations to assist the Afghan people at a time when they most urgently need it."