Militants have attacked an army base near a military academy in the Afghan capital Kabul.
At least two Afghan soldiers have been killed in the ongoing attack and 10 injured, a defence ministry spokesman told the BBC.
Five militants were involved, three of whom have been killed, he said.
The attack has now been claimed by the Islamic State, according to the militant group's Amaq news agency.
It comes days after the deadliest bombing for months hit Kabul when an ambulance packed with explosives killed at least 100 people.
Islamic State and the Taliban have increased their attacks on targets in the country in recent days.
Several explosions were heard, as well as small arms fire, as the attack began at about 05:00 local time (00:30 GMT) at a military base of the Afghan National Army in the west of Kabul.
The militants are believed to have been heavily armed with rocket-propelled grenade launchers.
One of the surviving attackers has been arrested, but officials said the other was still fighting with security forces.
Security forces have blocked off all roads in the area, Afghan media outlet Tolo said.
The president's spokesperson said that none of the attackers had been able to get further than the first gate, Tolo news reported.
Afghan military institutions are frequently targeted by militants.
'Sandhurst in the Sand'
The base is next to the Marshal Fahim National Defense University which has been targeted by Taliban militants before.
In October 2017, 15 military cadets were killed in an explosion outside the Marshal Fahim military academy as they were leaving by minibus.
The university is referred to as "Sandhurst in the Sand" as it is closely modelled on the officer training academy in Britain.
The Islamic State group said it had carried out an attack on the international charity Save the Children in Jalalabad last week.