At least 25 people were killed and more than 40 wounded during an attack by the Islamic State on the largest military hospital in the Afghan capital of Kabul on Tuesday, according to local officials. Gunfire and explosions resounded throughout the city late into the afternoon.

The attack, which included armed gunmen and at least one suicide bomber, targeted the 400-bed Sardar Mohammad Daud Khan military hospital in one of Kabul’s more well-to-do neighborhoods. Both wounded soldiers who fought for the former government and Taliban fighters were being treated at the hospital.

The hospital was rocked by two explosions and then heavy gunfire erupted between the attackers and the Taliban. One Taliban internal security official, who spoke to Al Jazeera anonymously, stated that a terrorist detonated a suicide belt at the entrance of the hospital and was quickly followed by several gunmen who attempted to storm the hospital.

“The attack was initiated by a suicide bomber on a motorcycle who blew himself up at the entrance of the hospital,” the official said, adding that all of the attackers were killed.

Among the dead Taliban was Hamdullah Mokhlis a senior commander who rushed to the scene and was killed in the fighting.

Al Jazeera reported that Hamdullah Mokhlis, a member of the hardline Haqqani network and an officer in the Badri Corps special forces, is the most senior figure to have been killed since the Taliban seized power in August.

“When he got the information that Sardar Daud Khan Hospital was under attack, Maulvi Hamdullah (Mokhlis), the commander of the Kabul corps, immediately rushed to the scene,” the Taliban media official said.

“We tried to stop him but he laughed. Later we found out that he was martyred in the face-to-face fight at the hospital,” he added.

A young boy who was injured in the bomb blast outside a Kabul military hospital is wheeled in for treatment. (Reuters)

Witnesses told the news media that an explosion rocked the entrance of the hospital, followed by gunfire that lasted about 10 minutes. Then a second larger explosion erupted near the entrance.

Zabihullah Mujahid, a spokesman for the Taliban, told the media that the attack was carried out by several members of the Islamic State. A car full of explosives outside the hospital also exploded, wounding dozens. Several Taliban fighters were killed and wounded in the ensuing gun battle, Mujahid said.

The Islamic State in Khorasan Province (ISIS-K) later claimed responsibility for the bombing in a statement released on its media channels. “Five Islamic State group fighters carried out simultaneous coordinated attacks on the sprawling site,” ISIS-K said,

One doctor at the hospital said that the gunmen had entered a ward filled with wounded Taliban fighters and shot them in their beds.

The Taliban, who were known for carrying out these types of attacks during the past 20 years against the U.S.-led coalition, now have the shoe on the other foot and are learning quickly how difficult it is to defend against actions such as these. 

ISIS-K suicide bombing attacks in Kabul, the northern city of Kunduz, and in Kandahar, Afghanistan’s second-largest city, have killed at least 90 people and wounded hundreds since the Taliban’s takeover.

In August, an Islamic State suicide bomber killed roughly 170 civilians and 13 U.S. servicemembers at the gates of Kabul’s international airport, as civilians were trying to flee the Taliban and be evacuated by the U.S. and NATO aircraft.

The Sardar Mohammad Daud Khan military hospital has been a frequent target through the years. It has repeatedly been attacked by both the Islamic State and the Taliban.