The attack, which was claimed by Daesh, saw four gunmen disguised as doctors storm the main military hospital in the Afghan capital, police said.
The Dawood Khan Military Hospital -- commonly known as the 400-Bed Hospital -- is in Kabul’s diplomatic enclave and close to the U.S. embassy and NATO headquarters. It is used by hundreds of civilians a day.
According to police, a suicide attacker detonated explosives at the hospital entrance before others armed with assault rifles and grenades stormed the building and made their way to the second and third floors.
“At this moment, I can only confirm that it is a complex attack involving a number of militants,” Interior Ministry spokesman Sediq Seddiqui told Anadolu Agency earlier.
“The Afghan National Police’s Special Forces have engaged them and soon they will be eliminated.”
Defense Ministry spokesman Dawlat Waziri told Anadolu Agency that police special forces were deployed by helicopter to clear the militants from the hospital.
The ministry confirmed that 30 people -- mostly hospital staff and patients -- and four attackers had been killed. Earlier, the Health Ministry had reported five dead and 50 wounded.
The NATO-led Resolute Support Mission had offered to assist the National Police in the operation to clear the hospital.
Deash claimed responsibility in a statement on the Amaq website. The group claimed to have killed more than 100.
President Mohammad Ashraf Ghani said the militants have defied all human values and attacked the entire Afghan nation by targeting a hospital.
Pakistan, which has recently blamed Afghanistan-based militants for attacks on its territory, condemned the assault and reaffirmed its “commitment to cooperation with the Afghan government and the international community for the elimination of the scourge of terrorism.”
Turkey condemns attack on hospital in Afghan capital
Turkey's Foreign Ministry condemned the terrorist attack on a military hospital in the Afghan capital Kabul that left dozens of people dead.
In a written statement, the ministry "strongly condemned the heinous attack" on the hospital "where people in need of care were receiving treatment.
"We wish Allah’s mercy upon those who lost their lives, speedy recovery to the wounded, and convey our condolences to the brotherly government and people of Afghanistan."
The attack came a month after Afghan forces launched a massive operation against pro-Daesh fighters in eastern Nangarhar province bordering Pakistan. More than 100 militants have been killed in the ongoing operation, according to officials.
In recent days, the Taliban attacked three security installations in Kabul, killing 22 people.