Taliban forces claimed that they repulsed the ISIS attack in Kabul within 15 minutes.
Kabul: At least 19 people were killed and 50 more wounded in an attack on a military hospital in Kabul on Tuesday, the latest atrocity to rock Afghanistan since the Taliban seized power.
The Taliban's rivals, ISIS, claimed responsibility for the gun and bomb assault in the centre of the capital.
Islamic State-Khorasan (IS-K), an affiliate of the terrorist group ISIS, said in a statement on its Telegram channels that "five Islamic State group fighters carried out simultaneous coordinated attacks" on the sprawling site.
"The IS insurgents wanted to target civilians, doctors and patients in the hospital," Taliban spokesman Zabiullah Mujahid said, claiming that Taliban forces had repulsed the attack within 15 minutes.
As part of the response, he said, Taliban "special forces" were dropped onto the roof of the hospital from one of the helicopters that the group seized from Afghanistan's former US-backed government.
The attack began when a suicide bomber detonated his explosives near the facility's entrance. Gunmen then broke into the hospital grounds, firing their weapons.
"Nineteen dead bodies and about 50 wounded people have been taken to hospitals in Kabul," a health ministry official who asked not to be named told AFP.
The Taliban spokesman played down the death count, but confirmed that two Taliban members, two women and a child had been killed outside the hospital.
One woman who had been trapped in the hospital when the attack began told AFP how she and her friend "felt we were going to die, that our lives were ending".
"There was a blast at the door," Rowana Dawari, a poet and lecturer, told AFP.
"Daesh came and started firing, we were stuck. We heard firing, glass breaking. We locked ourselves in a bathroom," she said, referring to ISIS by its local name.
Amanudhin, a 28-year-old cleaner at the hospital, pushed an elderly, frail and partially sighted patient, Mariam, away from the scene in a wheelchair.
"The explosion happened and after a while people started screaming 'Daesh is here'," he told AFP. "We heard a lot of firing.
"We were in the 7th floor and locked ourselves in a room. There were injured people everywhere. Broken glass."
They hid until Taliban members came and found them: "They were special forces, professionals, they broke the door and got inside."
Going 'room to room'
The Taliban spent 20 years waging an insurgency against the ousted US-backed government.
Now they face the struggle of bringing stability to Afghanistan, which has been hit in recent weeks by a series of bloody assaults claimed by the ISIS's local chapter.
"All the attackers are dead. The attack was initiated by a suicide bomber on a motorcycle who blew himself up at the entrance of the hospital," a Taliban media official said.
Two explosions targeted the hospital area, he had earlier said in a statement.
AFP staff in the city heard a second explosion some 30 minutes after the first was reported.
"I heard a big explosion coming from the first checkpoint. We were told to go to safe rooms. I also hear guns firing," a doctor at the Sardar Mohammad Daud Khan hospital told AFP while the attack was being carried out.
"I can still hear gun firing inside the hospital building. I think the attackers are going from room to room... like the first time it was attacked," the doctor added.
Ambulances speeding through Kabul
The hospital, which treats wounded soldiers from both the Taliban and former Afghan security forces, was previously attacked in 2017, when gunmen disguised as medical personnel killed at least 30 people in an hours-long siege..
ISIS have claimed four mass casualty attacks since the Taliban takeover on August 15, including suicide bomb blasts targeting Shiite Muslim mosques. The group regards Shiite Muslims as heretics.
The 2017 attack was also claimed by ISIS, and the Taliban denied responsibility.
Pictures shared on social media on Tuesday showed black smoke billowing into the air after the explosions, the first of which went off at around 1:00 pm (0830 GMT).
Roads close to the heavily fortified "Green Zone" where the buildings of several former Western embassies were located were closed off to traffic and Taliban guards scaled up searches.
The US State Department condemned the attack, spokesman Ned Price said in a tweet Tuesday evening.
"We mourn those killed and offer our condolences to their loved ones," he said. "Targeting medical professionals and patients is abhorrent and has no justification."