Militants launched a gun and bomb attack on the interior ministry in Kabul on Wednesday, killing one policeman and wounding at least five people, days after the Taliban vowed to target the Afghan capital.
Special forces rushed to the scene after the attackers detonated what police said was a car bomb at the first checkpoint leading to the ministry, then tried to fight their way inside.
"The fighting is over, the attackers have all been killed by security forces between the first and second security perimeter," Kabul police chief Daud Amin said.
A security source told AFP that a clearing operation was ongoing.
No group immediately claimed responsibility for the attack, and officials gave differing figures for the number of militants involved, with police saying three to five while interior ministry spokesman Najib Danish said there were at least 10.
Danish also said one police officer had been killed and five people wounded.
"The situation is under control now," he said, adding that there could be more explosions as police detonate suicide vests carried by the attackers.
"I was in my office when I heard a blast followed by gunfire. We were told to stay inside our offices as the compound was attacked," one ministry employee told AFP earlier.
A security source told AFP there had been multiple blasts, though he could not confirm how many.
Police also said they had found a car stuffed with explosives and guns at Kabul's international airport, which is near to the interior ministry, on Wednesday.
Both the Taliban and the Islamic State group have stepped up their attacks on Kabul, making it the deadliest place in the country for civilians in recent months.
Last week the Taliban called on Kabul residents to stay away from military and intelligence centres in the capital, saying they planned more assaults as part of their annual spring offensive.
"To avoid civilian casualties and only cause damage to enemy military, we are asking Kabul residents to keep away... we don't want even a single innocent civilian to be killed," said a statement published online.
In response, the defence ministry said police and troops are "ready to protect the people with all means possible", and would not allow the militants to reach their "un-Islamic and inhuman goals".
The Taliban did not define what was meant by "military and intelligence centres".
Such targets are difficult to avoid given that the heavily fortified city is the heart of the country's intelligence, government and military operations and plagued by traffic jams due to ubiquitous checkpoints and barriers.
Kabul accounted for 16% of all civilian casualties last year, when 1,831 civilians were killed or wounded nationwide, according to the United Nations Assistance Mission in Afghanistan.
The UN has warned that 2018 could be even deadlier.