There were two explosions and gunfire at the site of the Sardar Daud Khan military hospital.
More than 20 people have been killed and at least 16 injured in a gun and bomb assault on a military hospital in the Afghan capital Kabul.
Attackers targeted the 400-bed Sardar Daud Khan hospital starting with two massive explosions outside the building, officials said.
Gunmen then broke into the hospital grounds, witnesses said.
No-one has yet claimed responsibility, but the Taliban have blamed the Islamic State affiliate IS-K for the attack.
Photographs and video footage from Kabul showed a plume of smoke over the area and recorded the sounds of gunfire. A doctor in the building told the AFP news agency he had been sent to seek shelter in a safe room during the attack and could hear guns being fired.
Sayed Ahad told broadcaster EVN that one of the blasts was a suicide attack.
“As an Afghan citizen, I am really tired of this war, suicide and explosions,” he said. “How long do we have to endure this misery?”
The Taliban spokesman, Bilal Karimi, told the BBC that fighters from IS-K had entered the compound after detonating the first explosion at the entrance gate.
Mr Karimi said Taliban fighters shot and killed four IS-K attackers and captured one alive.
Taliban spokesman Zabihullah Mujahid meanwhile told Reuters news agency that Taliban special forces dropped by helicopter had stopped the attackers from entering the hospital itself, killing them at the entrance or in the building’s courtyard. All the assailants were killed in 15 minutes, he said.
Witnesses quoted by Reuters said they saw two helicopters over the area during the assault. The news agency reports that this would be one of the first times Taliban forces have used aircraft captured from the previous, Western-backed government during an operation.
The attack is the latest to hit Afghanistan since the Taliban seized control in August, after the US withdrew its last troops from the country.
IS-K, which stands for Islamic State Khorasan, has claimed responsibility for a number of attacks targeting civilians and Taliban fighters.
In August, a bombing by IS-K at Kabul international airport in August killed more than 150 civilians and 13 US soldiers.
The Sardar Daud Khan hospital has been targeted before. More than 30 people were killed and 50 others wounded in 2017 when gunmen dressed as doctors stormed the building. That attack was also claimed by the Islamic State group.