Fighting in the Afghan capital has finally ended, 18 hours after the Taliban launched their assault, officials have said.
A spokesman for Kabul's police chief said the last gunman, who was fighting near the parliament in the west of the city, was killed early on Monday.
Earlier, security forces flushed out insurgents in the central diplomatic area, home to several embassies.
Officials said at least 17 gunmen and one police officer have died.
Attackers also carried out raids in the provinces of Logar, Paktia and Nangarhar.
In Kabul, foreign embassies, Nato's HQ and the Afghan parliament were hit in the first major attack on the city in more than six months.
The Taliban said the co-ordinated attacks were part of the start of their "spring offensive" and their response to recent claims by Nato officials that the insurgency was weak.
"The latest information we have about the Afghan Parliament area is that the attack is over now and the only insurgent who was resisting has been killed," said the Kabul police chief's spokesman Hashmatullah Stanikzai.
In the central district of Wazir Akbar Khan, offcials said Special Forces raided a construction site which the attackers have been using as a base.
The BBC's Bilal Sarwary in Kabul says there are reports that the gunmen took several construction workers hostage.
Correspondents say the attacks have shattered the confidence of Afghans, as the insurgents have once more shown that they can strike right in the heart of Kabul.
The assault has also raised concern about security as Nato prepares to withdraw its troops by the end of 2014 and hand over reponsibility to Afghan forces.
Elsewhere in the country, gunmen attacked government buildings in Logar province, the airport in Jalalabad, and a police facility in the town of Gardez in Paktia province.