Kabul remains on high alert as the city braces for further attacks.
Kabul: Gunmen launched a pre-dawn raid on a military compound in Kabul on Monday, officials said, in an assault that caused multiple casualties and marked the third major attack in the city in recent days.
Defence ministry spokesman Dawlat Waziri said five soldiers were killed and 10 wounded in the assault claimed by the ISIS group via its propaganda arm Amaq.
"An Afghan army battalion has come under attack this morning. The attackers wanted to breach the battalion," Waziri said, adding the raid had ended.
"Two bombers detonated themselves and two were killed by our forces and one was detained alive. The fighting is over but unfortunately we have five deaths and 10 wounded."
He said Afghan forces had seized a rocket, two Kalashinkovs, and a suicide vest from the attackers.
Officials said the attack was on an army battalion near the Marshal Fahim military academy where high-ranking officers are trained and which was initially identified as the target. An officer at the academy said he could hear an explosion and gunfire.
The gunmen did not enter the heavily fortified compound, which is on the western outskirts of the city, an Afghan security source said.
Witnesses said they heard several explosions and gunfire at around 5:00 am (0030 GMT). Security forces have swarmed the area and blocked roads leading to it, but earlier an AFP reporter at the scene could also hear explosions.
In October a Taliban suicide bomber killed 15 Afghan army trainees as they travelled home from the Marshal Fahim academy.
Militants including the Taliban and ISIS have stepped up their attacks on beleaguered Afghan security forces in recent months, sapping morale already lowered by desertions and corruption.
Afghan troops have taken what the UN describes as "shocking" casualties since international forces pulled out at the end of 2014, though troop casualty figures are no longer released.
Kabul on edge
The latest raid comes days after a Taliban suicide attacker driving an explosives-packed ambulance blew up in a crowded area of the capital, killing at least 103 people and wounding 235 in one of the worst bombings in the city in recent years.
The government has blamed Saturday's lunchtime attack, which was followed by a national day of mourning in the war-weary country, on the Taliban-affiliated Haqqani Network, which Afghan and Western officials suspect of involvement in at least some of the recent attacks in the capital.
Monday's ambush came as both Taliban and ISIS militants have escalated their attacks on Kabul, turning it into one of the deadliest places in Afghanistan for civilians.
On January 20, Taliban fighters stormed Kabul's landmark Intercontinental hotel and killed at least 25 people, the majority foreigners, in an ordeal lasting more than 12 hours.
But there is still confusion over the true toll from that attack with conflicting figures given by officials and Afghan media reporting higher numbers.
Kabul remains on high alert as the city braces for further attacks. Security warnings sent to foreigners in recent days said ISIS militants were planning to attack supermarkets, hotels and shops frequented by foreigners.
IS fighters also attacked Save the Children's office in Afghanistan's east on Wednesday that officials said killed five people and wounded another 26.