Afghanistan's Defense Ministry says more than 30 people were killed 50 wounded when gunmen disguised as medical workers attacked a military hospital in Kabul.
Doctors, patients, and hospital staff were among the victims of the attack, which was claimed by the so-called Islamic State (IS) extremist group.
Medical officials said three gunmen wearing white lab coats began firing AK-47 assault rifles within the hospital compound after a suicide bomber blew himself up at the back entrance to the 400-bed facility.
General Dawlat Waziri, a Defense Ministry spokesman, said the attack set off a floor-by-floor battle with security forces at the facility, which is known as the Sardar Mohammad Daud Khan Hospital complex and is across the street from the U.S. Embassy.
Witnesses inside the hospital at the time of the attack said it was a "massacre."
Zahir Khan, who hid under a table and later escaped, said he saw one gunmen who "was shooting at everyone…doctors, patients, and visitors."
Patient Zia Zabuli said he was lucky to escape.
Hospitalized with a leg wound, Zabuli and three others barricaded themselves inside a room when they saw one of the gunmen approaching.
“Together we put beds, chairs, and whatever there was to barricade the door,” Zabuli said.
After several hours of fighting, the attackers took up positions on the top floor of the hospital.
They were shot dead after special forces landed on the roof of the hospital in a military helicopter.
The Islamic State (IS) extremist group claimed responsibility for the attack in a statement on the site of its propaganda website, Amaq.
It said: "Islamic State commandos attack the military hospital in Kabul."
Although the attack came as the Taliban ramped up attacks before the start of its annual spring offensive, a Taliban spokesman told media outlets that the group did not know anything about the attack.
"Today's Kabul attack has no connection" with the Taliban, the spokesman said separately in a tweet.
Last week, dozens of people were killed and wounded in a series of Taliban attacks on a police building and an intelligence-service compound in Kabul.
The NATO-led Resolute Support mission said it was ready to assist Afghan security services.
Afghan President Ashraf Ghani condemned the attack during a speech on the occasion of the International Women's Day, calling it "an attack on all Afghan people and all Afghan women."
The U.S. Embassy in Kabul said it "strongly condemns the attack and offered its condolences to relatives of the victims.
"The attack demonstrates the blatant disregard for human life by those seeking to disrupt Afghanistan’s democratic progress," the embassy said on its website. "Targeting a medical facility providing care for the brave Afghans working to protect their fellow citizens has no possible justification in any religion or creed."