Automatic gunfire broke out at a ceremony in Kabul on Sunday, forcing the Afghan president and other dignitaries to take cover, the AP reported.
A Defense Ministry spokesman said President Hamid Karzai, all Cabinet members and foreign diplomats were safe. Two lawmakers were reported wounded.
A Taliban spokesman claimed responsibility for the attack against Karzai, saying four militants with suicide vests and guns were nearby.
Hundreds of people fled in chaos as shots rang out. It was unclear where the firing was coming from. A live TV broadcast of the event in Kabul quickly cut out.
Karzai was escorted from scene, surrounded by bodyguards, in one of four black Landcruisers.
"President Hamid Karzai, with all the cabinet members and foreign diplomats who were on the main stage, are safe. They have been evacuated from the area. It is not an exact report yet, and I'm not sure, but I heard two parliamentarians are wounded," Defense Ministry spokesman Gen. Mohammad Zahir Azimi.
Sirajudin, a police officer at the scene, said he saw two people firing AK47 assault rifles from a house toward the area were Karzai and other dignitaries were sitting.
The gunfire erupted as the national anthem ended at a ceremony to mark the 16th anniversary of the victory over the Soviet invasion, which ended in 1992.
TV footage showed a couple of dignitaries slump in their seats as the shooting began. They appeared to be lawmakers.
Taliban spokesman Zabiullah Mujaheed said four insurgents near the national stadium where the event was held were wearing suicide vests and carrying AK-47s and rocket-propelled grenades to attack Karzai. He spoke to an AP reporter by phone from an undisclosed location.