KABUL -- Militants stormed a maternity hospital in the western part of Kabul on Tuesday, setting off an hours-long shootout with the police and killing 16 people, including two newborn babies, their mothers and an unspecified number of nurses, Afghan officials said.

While the battle was underway, Afghan security forces struggled to evacuate the facility carrying out babies and frantic young mothers, according to images shared by the Interior Ministry. The clinic is supported by the aid group Doctors Without Borders, according to UNICEF, the U.N. children's agency.

But the day's spasm of violence extended beyond Kabul. A suicide bomber in eastern Nangarhar province -- a hotbed of the Islamic State group -- targeted a funeral ceremony, killing 24 people and wounding 68. And in eastern Khost province, a bomb planted in a cart in a market killed a child and wounded 10 people.

The violence could further undermine a peace process in the wake of a deal signed between the United States and the Taliban in February, which envisages the start of talks among key Afghan figures, including government representatives, and the Taliban. Relentless, near-daily attacks have also left Afghan authorities ill-prepared to face the onset of the coronavirus pandemic, which has infected more than 4,900 people in the country and killed at least 127.

No one immediately claimed responsibility for the attack in Kabul, where both the Taliban and the IS frequently target Afghan military and security forces, as well as civilians. The Taliban denied they were involved.

But in a televised speech hours after the attacks, Afghan President Ashraf Ghani announced that Afghan security forces would no longer operate in the defensive posture taken in the wake of the peace agreement. Instead, he called on security forces to launch attacks against Taliban insurgents.

"The Taliban have not given up fighting and killing Afghans, instead they have increased their attacks on our countrymen and public places," despite repeated calls for a cease-fire, Ghani said.

U.S. Secretary of State Mike Pompeo in a statement condemned the attacks, and noted that the Taliban denied responsibility and also condemned both attacks.

"The Taliban and the Afghan government should co-operate to bring the perpetrators to justice," Pompeo said. "As long as there is no sustained reduction in violence and insufficient progress towards a negotiated political settlement, Afghanistan will remain vulnerable to terrorism."

Soon after the Kabul attack started, black smoke rose into the sky over the hospital in Dashti Barchi, a mostly Shiite neighbourhood that has been the site of many past attacks by Islamic State militants. The Interior Ministry spokesman, Tareq Arian, said over 100 women and babies were evacuated from the building before it was over.

Arian said 15 others, including women, men and children were wounded in the attack. Three foreign nationals were among those safely evacuated, he said, without elaborating. It was unclear why the maternity hospital in Dashti Barchi, a 100-bed facility, was targeted -- an attack Arian said was an "act against humanity and a war crime."

Photos shared by the Interior Ministry during the Kabul attack show newborn babies and their mothers being carried out of the hospital by Afghan security forces.

By mid-afternoon, the ministry issued a statement saying three attackers had stormed the hospital and that one was shot and killed while the other two were still resisting arrest. The first floor of the clinic was cleared but the operation was ongoing to secure the rest of the building, the statement said.

A few hours later, the ministry released another statement, saying all three attackers were dead and that the operation was over.

In the evening hours, husbands, fathers and family members of the hospital's patients gathered around the site in Dashti Barchi, desperate for news of their loved ones. A man read out the names of those who had been evacuated to other hospitals.

In the Nangarhar attack, the suicide bomber targeted the funeral in Khewa district of a local pro-government militia commander and former warlord who had died of a heart attack Monday night, said Attahullah Khogyani, spokesman for the provincial governor.

The Interior Ministry said the final casualty toll included 24 killed and 68 wounded. The casualties were brought to the Nangarhar provincial hospital, said hospital spokesman Gulzada Sangar. Khogyani added that the dead included Abdullah Lala Jan, a provincial council member, while his father Noor Agha, a lawmaker, was wounded in the attack.

According to Zabihullah Zemarai, another provincial council member, dozens of people, including, lawmakers, provincial council members and locals had gathered for the funeral of Shaikh Akram, the militia commander. Taliban spokesman Zabiullah Mujahid tweeted that the Taliban were not involved in the attack.

Also, no group claimed responsibility for the attack in Khost, which killed a child and wounded 10 people. The bomb was placed in a cart at a local market and remotely detonated, said Adil Haidari, spokesman for the provincial police chief.

------

Associated Press writers Tameem Akhgar in Kabul, Afghanistan, Kathy Gannon in Islamabad and Matthew Lee in Washington contributed to this report.