The moment when gunfire broke out at the military parade
Three people have been killed and about 10 injured in an attack on a military parade in Kabul attended by Afghan President Hamid Karzai.
Security forces whisked Mr Karzai and away and hundreds fled as shots rang out. An MP and a 10-year-old child were among the dead, officials said.
The parade was a celebration to mark 16 years since the overthrow of the country's Soviet-backed rule.
A spokesman for the Taleban said the movement had carried out the attack.
He said they had not targeted Mr Karzai directly, but wanted to show how easily they could get access to such events.
The BBC's Alastair Leithead in Kabul says the fact that they were able to get so close despite such tight security is worrying for both the government and the international community.
The Taleban spokesman said six militants had been deployed near the parade with suicide vests and guns. Three of them were killed and the other three arrested, he added.
In a live TV address after the incident, Mr Karzai confirmed that there had been arrests.
"Fortunately Afghan security forces quickly surrounded them," he said. "Some of them were captured."
"Everything is calm, rest assured."
Mr Karzai has frequently been the target of assassination attempts in recent years.
Later UK Prime Minister Gordon Brown phoned Mr Karzai to express his relief that he was safe and reaffirm his support for the Afghan government.
The parade, in central Kabul, was part of Afghan National Day celebrations, marking the capture of Kabul from the Soviet-backed government by the mujahideen in 1992.
The national anthem was being played when the attack started.
Live TV showed President Karzai standing on a huge stage surrounded by a crowd of MPs, cabinet members, military commanders and foreign diplomats.
PREVIOUS ATTACKS ON KARZAI
June 2007 - Taleban fire rockets at school in Ghazni province where he is speaking, no-one hurt
Sept 2004 - Rocket fired at landing site of helicopter taking Mr Karzai to Gardez in the south-east, no-one hurt
Sept 2002 - Militant dressed in Afghan army uniform fires at Mr Karzai's car in Kandahar, wounding the province's governor and a bodyguard
Automatic weapons were fired into the crowd and two people, apparently MPs, were seen slumping into their chairs.
Afghan Health Minister, Mohammad Amin Fatimie, who was sitting a few metres from Mr Karzai, described how bullets flew past the president.
"As soon as the first bullets hit, the president was covered by bodyguards," he said.
"I could see bullets ricocheting, black smoke, and I could smell gunpowder," he said.
"As the bullets were hitting the stage, I saw something - most likely a rocket-propelled grenade - land and explode in front of the stage," the minister said.
The US and UK ambassadors and the Nato military commander were among dignitaries bundled away by security forces.
UK ambassador Sir Sherard Cowper-Coles, who was in the front row, told Reuters news agency:
"It was coming to the end of the 21-gun salute. I saw an explosion and a puff of dust to the left of the parade and then heard the crackle of small arms fire from all directions.
Live TV coverage of the event was cut off shortly afterwards, and the state channel switched to music.
Sirajudin, a police officer at the scene, told the Associated Press news agency he saw two people firing AK-47 assault rifles from a house toward the area of the stage.
At least one explosion followed the gunfire, and security forces returned fire.
Soldiers dressed in ceremonial garb were seen running from the scene.
The event, which had been shrouded in tight security for days, was cancelled soon afterwards. Police and army are now in control of the area.