Gunmen stormed a maternity hospital in the western part of the Afghan capital Kabul, setting off an hours-long shoot-out with the police and killing 16 people, including two newborn babies, their mothers and an unspecified number of nurses.

Photos from the Ministry of Interior Affairs showed two young children lying dead inside the hospital.

An image showed a woman who had been killed lying on the ground still holding tightly to her baby, who a nurse in the unit confirmed to Reuters news agency had survived and had been moved to an intensive care unit at another hospital.

Security forces earlier cordoned off the area as they evacuated more than 80 women and infants from the hospital, where medical charity Doctors Without Borders (Medecins Sans Frontieres, or MSF) runs a maternity clinic.

Interior ministry spokesman Tareq Arian said three foreign nationals were among those safely evacuated, 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”. 

At least three attackers wearing police uniforms entered the hospital, throwing grenades and shooting, officials said.

A paediatrician who fled the hospital told AFP news agency he heard a loud explosion at the entrance of the building in Dashti Barchi, a mostly Shia neighbourhood that has seen past attacks by the ISIL (ISIS) armed group.

“The hospital was full of patients and doctors, there was total panic inside,” the doctor said, asking not to be named.

In the evening hours, husbands, fathers and family members of the hospital’s patients gathered around the hospital, desperate for news of their loved ones.

A man read out the names of those who had been evacuated to other hospitals.

The neighbourhood is home to many members of Afghanistan’s Hazara community, a mostly Shia Muslim minority that has been attacked by ISIL in the past, including at a Kabul ceremony commemorating the death of one of its leaders in March.

Rights group Amnesty International condemned both the attacks.

“The unconscionable war crimes in Afghanistan today, targeting a maternity hospital and a funeral, must awaken the world to the horrors civilians continue to face,” the group tweeted.

“There must be accountability for these grave crimes.”

Countries including the United Kingdom, Germany, Turkey and Pakistan released statements condemning the violence.