Afghan President Hamid Karzai survived an assassination attempt at a military ceremony in Kabul on Sunday, but one person was killed and nine others were wounded in the attack.

afghan-assas-cp-4756665

Afghan soldiers run after gunfire erupted at a ceremony in Kabul on Sunday. ((Musadeq Sadeq/Associated Press))

Taliban insurgents opened fire with automatic weapons, forcing Karzai, as well as government ministers and foreign diplomats, including ambassador Arif Lalani from Canada, to dive for cover.

A Taliban spokesman claimed responsibility for the attack, saying it had deployed four militants with suicide vests and guns to target the president.

Hundreds of people were attending the event to mark the 16th anniversary of the defeat of Soviet forces, who invaded Afghanistan in 1979. 

The annual parade was being shown live on Afghan television and the country's national anthem was being played when gunfire erupted. The live broadcast was interrupted and state television switched to music.

Witnesses said the gunfire was followed by at least one smaller explosion, possibly caused by a hand grenade or a mortar — and Afghan security forces returned fire.

Two Afghan politicians were seriously injured, the presidential palace said. Video footage showed them sitting about 30 metres from Karzai when shots were fired. One of the men slumped back in his seat, while the other lay on the ground.

Karzai was surrounded by bodyguards and rushed from the scene. He appeared on television two hours after the attack, which he said had been carried out by enemies of Afghanistan. He also said suspects had been arrested.

With files from the Associated Press