US-backed Afghan forces removed the Taliban from power in 2001, highlighted the ability of militants to strike the heavily guarded diplomatic zone even after more than 10 years of war.
It was also another election-year setback in Afghanistan for US President Barack Obama, who wants to present the long 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.
Fighting was still raging after nightfall, more than five hours after the Taliban first struck.
The Taliban said 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.
Large explosions shook the diplomatic sector of Kabul. Billows of black smoke rose from embassies while rocket-propelled grenades whizzed overhead.
Heavy gunfire could be heard from many directions as Afghan security forces tried to repel Taliban fighters.
Taliban fighters, some of them dressed in women's head-to-toe covering burqas, also launched simultaneous assaults in three other provinces of Afghanistan.
In the eastern city of Jalalabad, they attacked a foreign force base near a school and a blast went off near the airport.
The ministry of interior said 19 insurgents, including suicide bombers, died in the encounters across the country and two were captured. Fourteen police officers and nine civilians were wounded.
US ambassador Ryan Crocker said it was unlikely the Afghan Taliban had the capacity to launch Sunday's attacks on its own, and speculated that the Haqqani network - whose fighters are based in the Afghanistan-Pakistan border area - were involved.
"The Taliban are really good at issuing statements. Less good at actually fighting," he told CNN.
"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. Frankly I don't think the Taliban is good enough."
Afghan interior ministry spokesman Sediq Sediqqi told Reuters initial findings showed that the Haqqanis were involved in Sunday's attacks.
The Afghan government's Interior Ministry said on Sunday that initial intelligence on a wave of insurgent attacks across the country pointed to involvement of the militant Haqqani Network.
"It's too early to say, but the initial findings show the Haqqanis were involved," Interior Ministry spokesman Sediq Sediqqi told Reuters.
Sediqqi said figting had ended in the eastern provinces of Paktia and Nangarhar, but continued in parts of central Kabul including the upmarket Sher Pur neighbourhood and a major supermarket favoured by expatriate Westerners.
The United States accused Pakistan of having links to the Haqqanis last year after an attack on the U.S. embassy and other targets in Kabul that it blamed on the group.
The Haqqani network is one of the most divisive issues between Washington and Islamabad, whose relations were badly damaged last year by the unilateral American raid that killed al Qaeda leader Osama bin Laden in a Pakistani town.
Washington has repeatedly urged the Pakistani military to go after the Haqqani network, which is believed to be based in Pakistan's North Waziristan region on the Afghan border.
Evidence that the Haqqanis were behind the latest attacks in Afghanistan could hamper efforts to patch up U.S.-Pakistan ties between the strategic allies.
The Taliban said in a statement that "tens of fighters", armed with heavy and light weapons, and some wearing suicide-bomb vests, carried out the multi-pronged assault.
Taliban spokesman Mujahid said it had been easy to bring fighters into the capital, and they had had inside help to move heavy weapons into place. He did not elaborate.
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 transition to Afghan security control, and days before a meeting of defence and foreign ministers in Brussels to prepare for the Chicago summit.
Afghan security forces apparently failed to learn lessons from a similar operation in Kabul last September in which when insurgents entered construction sites to use them as positions for rocket and gun attacks.
The latest attack came just as Western forces prepare to leave as part of a plan to hand over responsibilities to the Afghan forces by 2014.
That may prompt some to draw comparisons with the 1968 Tet Offensive during the Vietnam War. There are major differences in the scale and length of the events and casualties but the assault may still challenge assertions that America is winning.
Witnesses said 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.
Sunday's attack took place hours after dozens of Islamist militants stormed a prison in neighbouring Pakistan in the dead of night and freed nearly 400 inmates, including one on death row for trying to assassinate former President Pervez Musharraf.
Pakistan's Taliban movement, which is close to al Qaeda, said it was behind the brazen assault by militants armed with rocket-propelled grenades and AK-47 assault rifles.
Pakistan's Taliban are closely linked with their Afghan counterparts. They move back and forth across the unmarked border, exchange intelligence, and provide shelter for each other in a region Obama has described as "the most dangerous place in the world".
Pakistan's Taliban have said in recent months they would boost cooperation with the Afghan Taliban in their fight against US-led NATO forces.
Both the attacks in Afghanistan and the jailbreak in Pakistan underscore Pakistan's failure to tackle militancy on both sides of the border eleven years after joining the U.S.-led campaign against Islamist militancy.
'All Indians are safe'
All Indians are safe in Afghanistan after heavily-armed Taliban suicide bombers unleashed a wave of coordinated attacks in Kabul and three other cities and the situation is being closely watched by the Indian government.
"Indian Ambasador in Afghanistan Gautam Mukhopadhyay has briefed external affairs minister SM Krishna, who is presently on a visit to UAE, about the ground situation following the terror strikes," official sources said.
The sources said all Indians are safe and government was closely watching the situation after explosions and firing rocked different areas in Kabul including at the diplomatic enclave.
The ministry of external affairs in a statement said it was in constant touch with the Embassy in Kabul and all Indians are reported to be safe.
Afghan security forces, who are responsible for the safety of the capital, were scrambling to reinforce areas around the so-called green diplomatic section of the city centre.
Attackers fired a rocket-propelled grenade that landed just outside the front gate of a house used by British diplomats in the city centre and smoke billowed from the area after the blast, a Reuters witness said.
British embassy sources said staff were in a lockdown.
Two rockets hit a British Embassy guard tower near the Reuters office in the city.
Fighting was going on at some facilities of Nato's International Security Assistance Force (ISAF) and near the US, Russian and German embassies, ISAF said via Twitter.
Attack 'start of spring offensive' | Afghan MPs fire on militants
(With inputs from Reuters, AFP, PTI)