Security officials have repulsed a coordinated attack by gunmen on an intelligence service training centre in Kabul, a day after a suicide bomber killed dozens of students, an official at the centre said.
Two attackers besieged the training facility overseen by the National Security Directorate - Afghanistan's intelligence agency - opening fire as Afghan security forces moved in to cut them off.
Explosions and gunfire were reported close to the centre training in Qala-Wazir, as the siege took place on Thursday morning.
Two gunmen were killed by security forces in a standoff which lasted more than five hours, wounding three Afghan security officials.
"Clashes are ongoing and the area is cordoned off by the Afghan security forces," Kabul police spokesman Hashmat Stanikzai said earlier.
Kabul security forces closed off all roads around the complex under siege and evacuated residents.
There was no immediate claim of responsibility for the attack, but both the Taliban and ISIS operate in Afghanistan.
The attack in Kabul happened while Shiite residents held funeral services for the victims of a suicide bombing in a classroom, and ISIS claimed responsibility.
The bomber walked into a classroom of a one-room building at a Shiite educational centre where he set of his explosives. Kabul's hospitals were overwhelmed by the influx of students seeking emergency treatments, leading to a confusion about the number of people killed.
The man who killed 34 students was identified by ISIS as "the martyrdom-seeking brother Abdul Raouf al-Khorasani."
Hundreds of people turned out to pay their respects in a mass burial of 15 of the students. The remaining victims were taken to their villages to be buried there.
An Afghan official says four policemen were killed and four more injured while trying to defuse a car bomb in southern Kandahar province, a former Taliban stronghold, late on Wednesday. No one has claimed responsibility for the attack.
The assault happened at the end of a bloody week for Afghanistan, in which three attacks by the Taliban killed more than 200.
On August 10 the Taliban launched a coordinated offensive on the city of Ghazni, overrunning Afghan security forces and capturing much of the city. The siege lasted five days, before Afghan forces, supported by US and Nato airstrikes pushed the Taliban out of the city.
Small pockets of normality started to open up in the city on Wednesday as aid arrived, and partial mobile service returned to the area.
Meanwhile, on the night of August 13 the Taliban launched an offensive on a military base in Faryab province, in the northwest of the country. In a battle which lasted 48 hours, security forces were told reinforcements and airstrikes could not come as they were busy in Ghanzi.
The next evening, another offensive was launched on two outposts in Baghlan province. At least 46 security officials were killed in that attack.
The surge in violence comes weeks after Afghans marked an unprecedented country-wide ceasefire with the Taliban and government forces in June.