A gun battle triggered Monday when the Taliban attacked the Kabul traffic police headquarters ended after eight hours when Afghan security forces killed the last assailant holed up in the building, officials said.
This was the second attack by Taliban insurgents in the Afghan capital within a week.
"All the five attackers were killed and the area is now being cleared by the police," said Sediq Sediqqi, the spokesman for the Interior Ministry.
Sediqqi said that three traffic police officers were killed and 12 people - including six civilians - were wounded in the attack.
Three of the suicide bombers were killed by security forces while the other two blew themselves up, according to officials.
Two of the attackers holed themselves up on the third floor of the building, and exchanged gunfire with the security forces for hours, a police official said.
"Parts of the building have caught fire, probably damaging important traffic documents," he said on condition of anonymity.
The assailants, wearing explosives-laden vests, attacked the traffic department early Monday with guns and heavy weapons, police said. They also remotely detonated a car bomb outside the premises.
Explosions and gunfire were heard throughout the day as Afghan forces tried to take control of the building. According to witnesses and television footage, several shops and buildings near the traffic department were badly damaged.
The department is responsible for traffic management, issuing driving licences and car permits. The traffic police do not carry guns, and their building is less secure than other government buildings.
The building is adjacent to the border police headquarters, which Taliban militants said was their prime target. It was not clear whether the assailants were able to attack the border police.
The Taliban claimed responsibility for the attack.
"A large number of martyr-seeker mujahidin armed with suicide vests, rocket-propelled grenades and light weapons attacked this morning the centre of foreign special forces' trainers and some police and other centres, killing a number of Afghan police officers and foreign trainers," spokesman Zabiullah Mujahid Taliban said.
On Wednesday, six insurgents launched a deadly attack on the Afghan intelligence office, in which all six insurgents and one agency guard were killed, and scores of Afghans, mainly civilians, wounded.