An airstrike that killed at least 19 people in a hospital run by Médecins Sans Frontières in the Afghan city of Kunduz on Saturday was "utterly tragic, inexcusable, and possibly even criminal," the UN human rights chief said.

"The seriousness of the incident is underlined by the fact that, if established as deliberate in a court of law, an airstrike on a hospital may amount to a war crime," Zeid Ra'ad al-Hussein said in a statement, calling for a full and public investigation.

The U.S. military acknowledged it may have bombed the hospital, saying Saturday in a statement that it was targeting Taliban insurgents who were directly firing on U.S. troops.

Médecins Sans Frontières, also known as Doctors Without Borders, said its hospital was treating more than 100 patients and came under "sustained" attack at 2:08 a.m. local time.

The dead included seven patients from the intensive care unit, among them three children, and nine local MSF staff, the organization said. A total of 37 people, including 19 staff and 18 patients and caretakers, were injured, five of them critically. Another 30 people were still missing after the incident, MSF said.

Deeply shocked at bombing of MSF hospital in <a href="https://twitter.com/hashtag/Kunduz?src=hash">#Kunduz</a>. Staff and patients killed. MSF urges fighting parties to respect health facilities —@MSF

All of the charity's international staffers were alive and accounted for, it said. MSF Canada confirmed separately that no Canadians were killed.

Afghan President Ashraf Ghani's office released a statement saying he had spoken with "the commander of NATO's Resolute Support Mission," without naming U.S. army Gen. John Campbell. The statement says the commander "explained and apologized for the attack."

U.S. Defence Secretary Ash Carter said a full investigation is underway. "The area has been the scene of intense fighting the last few days. U.S. forces in support of Afghan security forces were operating nearby, as were Taliban fighters," he said in a statement.

Taliban seized Kunduz

Afghan forces backed by U.S. airstrikes have been battling the Taliban street-by-street in Kunduz since Thursday, to dislodge insurgents who seized the strategic city three days earlier in their biggest foray into a major urban area since the U.S.-led invasion of 2001.

Afghanistan's Ministry of Defence said "terrorists" armed with light and heavy weapons had entered the hospital compound and used "the buildings and the people inside as a shield" while firing on security forces.

Injured Médecins Sans Frontières (Doctors Without Borders) staff are seen after an explosion near their hospital in the northern Afghan city of Kunduz on Saturday. (Médecins Sans Frontières/Associated Press)

Interior Ministry spokesman Sediq Sediqqi said 10 to 15 "terrorists" had been hiding in the hospital at the time of the strike. "All of the terrorists were killed but we also lost doctors," he said.

MSF said that from 2:08 a.m. to 3:15 a.m. local time Saturday, the hospital was hit by bombs at 15-minute intervals. It quotes Kunduz-based doctor Heman Nagarathnam saying the planes repeatedly circled overhead during that time.

"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," Nagarathnam said, according to the MSF statement.

"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."

Hospital co-ordinates given to both sides

MSF said it gave the location of the hospital to both sides several times in the past few months, as well as this week, to avoid being caught in crossfire. The medical charity said its staff phoned military officials at NATO in Kabul and Washington during the morning attack, but bombs continued to rain down for nearly an hour.

U.S. army spokesman Col. Brian Tribus acknowledged that a strike launched by U.S. forces around 2:15 a.m. "may have resulted in collateral damage to a nearby medical facility."

MSF said in a statement: "All indications currently point to the bombing being carried out by international coalition forces. MSF demands a full and transparent account from the coalition regarding its aerial bombing activities over Kunduz on Saturday morning."

The hospital became engulfed in flames after Saturday's explosion in Kunduz. The international charity Médecins Sans Frontières said the "sustained bombing" took place at 2:10 a.m (Médecins Sans Frontières via Associated Press)

"This attack is abhorrent and a grave violation of International Humanitarian Law," MSF president Meinie Nicolai added. "We cannot accept that this horrific loss of life will simply be dismissed as 'collateral damage.' "

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 organizations to assist the Afghan people at a time when they most urgently need it."

The U.S. military has unleashed 12 airstrikes this week in support of government forces in the city. Most airstrikes hit targets on the city's outskirts and the overnight strike was only the second in a central area, the military said.

Saturday's deadly disaster could renew concerns about the use of U.S. air power in Afghanistan, a controversial issue in America's longest war. Former President Hamid Karzai fell out with his backers in Washington over the number of civilians killed by bombs.