capital's central districts through the night, with explosions and gunfire lighting up alleys and surrounding streets.
Smoke rises from a hotel after it was hit by a rocket-propelled grenade in Kabul, Afghanistan. AP photo
"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.
The fighting at the parliament in the west of the city was the only pocket where militants were still resisting security forces. Earlier, at daybreak, security forces flushed out militants holed up near embassies in the heavily guarded diplomatic area.
Nato helicopters had launched strafing attack runs on gunmen hiding in a construction site overlooking the Nato headquarters and several embassies, including the British and German missions.
Elite soldiers scaled scaffolding to outflank the insurgents, who appeared to have dug them themselves in on the second floor from the top of the construction site. Bullets ricocheted off walls, sending up clouds of brick dust.
"I could not sleep because of all this gunfire now. It's been the whole night," said local resident Hamdullah.
The assault by the insurgents, which began with attacks on embassies, a supermarket, a hotel and the parliament, is one of the most serious on the capital since US-backed Afghan forces removed the Taliban from power in 2001.
The Taliban said in a statement that heavy gunbattles were continuing in Logar province.
Strike on the diplomatic zone
The attacks highlighted the ability of militants to strike the diplomatic zone of the city even after more than 10 years of war.
The ministry of interior said 19 insurgents, including suicide bombers, had died in the attacks in Kabul and in at least three provinces and two were captured. Fourteen police officers and nine civilians were wounded.
The Taliban claimed responsibility for the attacks, but some officials said the Haqqanis, a network of tribal militants who live along the Pakistan-Afghanistan border, were likely involved.
"My guess, based on previous experience here, is this is a set of Haqqani network operations out of north Waziristan and the Pakistani tribal areas," American Ambassador Ryan Crocker told CNN.
"Frankly I don't think the Taliban is good enough."
The attacks were another election-year setback in Afghanistan for US President Barack Obama, who wants to present the campaign against the Taliban as a success before the departure of most foreign combat troops by the end of 2014.
"These attacks are the beginning of the spring offensive and we had planned them for months," Taliban spokesman Zabihullah Mujahid told Reuters.
He said the onslaught was revenge for a series of incidents involving American troops in Afghanistan - including the burning of Korans at a Nato base and the massacre of 17 civilians by a US soldier - and vowed that there would be more such attacks.
The Taliban said on Sunday the main targets were the German and British embassies and the headquarters of the Nato-led force. Several Afghan members of parliament joined security forces repelling attackers from a roof near the parliament.
The attacks in Kabul come a month before a Nato summit at which the United States and its allies are supposed to put finishing touches on plans for the transition to Afghan security control, and days before a meeting of defence and foreign ministers in Brussels to prepare for the alliance's summit in Chicago.
They also come in the run-up to Western forces leaving Afghanistan under a plan to hand over responsibilities to the Afghan forces by 2014.
Afghan security forces apparently failed to learn lessons from a similar operation in Kabul last September, when insurgents entered construction sites to use them as positions for rocket and gun attacks.
On Sunday, insurgents entered a multi-storey construction site overlooking the diplomatic triangle and behind a supermarket. There they unleashed rocket-propelled grenades and gunfire, protected from the view of security forces by green protective netting wrapped around the skeleton of the building.
Hours earlier in neighbouring Pakistan, dozens of Islamist militants had stormed a prison in the dead of night and freed nearly 400 inmates, including one on death row for trying to assassinate former President Pervez Musharraf.Haqqani's involved? | US, Taliban fight for highway | Kabul under attack