The soldier who killed four French soldiers near Kabul was angered by a video showing US marines urinating on the corpses of Taliban insurgents, a spokesman for the Afghan military said.

The 21-year-old recruit went on the shooting spree after seeing the video, which was widely distributed on YouTube and other video-sharing websites.

It is still uncertain if the video was the sole motivation for the attack, in which dozens of French troops were also wounded. An Afghan man in army uniform opened fire during a sports training exercise in the latest of several attacks in which Western soldiers have been killed by Afghan security forces.

French President Nicolas Sarkozy threatened to pull out all forces from Afghanistan after the killing.

The video showed men in the uniform of US Marines urinating on dead Taliban fighters. The footage, which is less than one minute long, shows three Taliban corpses. One of the men chuckles as they urinate. Another says "Have a great day, buddy".

The video aggravated anti-American sentiment in Afghanistan after a decade of a war that has seen other cases of abuse, notably the systemic abuse of prisoners in the notorious Abu Ghraib prison in 2004.