Kabul was hit by explosions and gunfire as suicide bombers struck across Afghanistan in coordinated attacks claimed by Taliban insurgents as the start of a spring offensive.

US, British, German and Japanese embassy compounds came under fire as militants tried to storm parliament - sparking a gun battle in which lawmakers and bodyguards fired back from the rooftop.

President Hamid Karzai was moved to a safe area and his palace went into lockdown as the capital was hit by a wave of attacks including a failed attempt to kill one of his deputies.

Insurgents armed with heavy machineguns, rocket propelled grenades and suicide vests launched what the Taliban spokesman said was a "coordinated attack" in Kabul and three eastern towns near the capital.

A total of 19 insurgents died and 14 police and nine civilians were wounded, the Interior Ministry said.

In Kabul the insurgents took up positions in construction sites overlooking government buildings, diplomatic missions and other high profile targets, unleashing a stand-off with security forces throughout the afternoon and evening.

Lutfullah Mashal, a spokesman for the National Directorate of Security, said Mohammad Karim Khalili, one of Karzai's two deputies was one of the targets of the attacks.

Mashal said the group of three tasked with attacking Khalili's home in west Kabul was captured before reaching their target.

They claimed they were linked to the Haqqani Network, he said, a hardcore Taliban branch accused of masterminding most of the high-profile attacks in Kabul and known to have close links to al-Qaeda.

The attacks will raise fears over the precarious security situation in Afghanistan as NATO prepares to withdraw its 130,000 troops by the end of 2014 and hand responsibility for security to Afghan forces.