The attack on Afghanistan's largest military hospital ended after a lengthy gun battle between the assailants and special security forces.
More than 30 people were killed and dozens more wounded on Wednesday when four Daesh militants dressed as medical personnel stormed Afghanistan's largest military hospital in the capital Kabul.
A security official said the attack began with a suicide explosion at the rear of the 400-bed Sardar Mohammad Daud Khan hospital before three attackers with automatic weapons and hand grenades entered the complex.
Special security forces launched a clearance operation that ended after a lengthy gun battle with the militants who had taken up positions on the upper floors of the hospital.
TRT World's Bilal Sarwary reports on the latest from Kabul.
The dead included doctors, patients and hospital staff.
Defence Ministry spokesman Dawlat Waziri said the attack was suppressed by mid-afternoon with all three gunmen killed.
Daesh claimed responsibility for the attack on its news agency Amaq.
Earlier, the Afghanistan Taliban distanced itself from the attack and a spokesperson said the group had "no connection" to the assault.
TRT World speaks to Colin Cookman from the United States Institute of Peace Center for South & Central Asia about militant groups in Afghanistan.
President Ashraf Ghani denounced the attack on the hospital. "In all religions, a hospital is regarded as an immune site and attacking it is attacking the whole of Afghanistan."
Earlier, security forces blocked off the area around the hospital and special forces soldiers descended on the roof of the main building from helicopters.
Sporadic gunfire could be heard for hours and, as fighting went on, there was a second explosion, which a spokesman said was caused when a car inside the hospital complex blew up.
This latest attack comes a week after at least 20 people were killed in simultaneous Taliban suicide assaults on two security compounds in Kabul.