Kabul police spokesman Basir Mujahid said two police officers were injured during an intense fighting, but there were no civilian casualties.
"The attack has ended. Two attackers were killed... only two police were wounded," the spokesman noted.
An unnamed source with the National Directorate of Security (NDS), however, said that at least three assailants were killed in the ensuing gun battle.
"They were well hidden in buildings under construction. We exploded their VBIED (vehicle-borne improvised explosive device) and killed two or three of them,” the source said.
Local residents and witnesses said that roads to the area had been closed and dozens of police and intelligence officers had blocked access to the public during the assault.
"I was going toward my school. It (the attack) happened suddenly... the police arrived in the area fast and blocked the roads, not allowing anyone to get to their homes," AFP quoted an Afghan student as saying.
On Monday morning, militants stormed an under-construction facility belonging to the NDS, triggering gunfight with security forces. The attackers used rocket-propelled grenades and light weapons.
Daesh claimed responsibility for the attack via its propaganda outlet.
Elsewhere in the country, a Taliban attacker late on Monday detonated a car bomb in Lashkar Gah, the capital of the southern Helmand province, killing at least two civilians and wounding 30 people.
Ghafar Sapay, Helmand police chief, said that at least a dozen of the wounded were police personnel.
In recent months, the Afghan capital has become one of the deadliest places for civilians, as the resurgent Taliban and increasingly Daesh both step up their attacks on civilians and security installations.
On May 31, a massive truck bomb ripped through the city's diplomatic quarter, killing about 150 people and wounding around 400, mostly civilians. No group officially claimed responsibility for that attack, which the Kabul government blamed on the Taliban-allied Haqqani Network.
A spate of attacks in October claimed the lives of around 150 people across the country.
Last month, a Daesh terrorist blew up his explosives outside a political gathering in Kabul, killing at least 14 people.
Daesh has been seeking to expand its presence in Afghanistan after losing the territories under its control in Iraq and Syria, where it first emerged in 2014.
Afghanistan is engulfed by violence and many parts of the country remain plagued by militancy despite the presence of foreign troops. The United States and its NATO allies invaded the country as part of Washington’s so-called war on terror in 2001, which toppled the Taliban.