The Islamic extremist who tried to murder a French soldier in public has confessed to the crime, prosecutors say.

Traces of DNA on an orange juice bottle and a surveillance video of a man praying in a mall led to the arrest of the suspect in the attack on the soldier who was patrolling a crowded area just outside Paris.

It came days after Drummer Lee Rigby was killed in London, raising fears of potential copycat strikes. France has also been on heightened security alert since its military intervention in January in the African nation of Mali to oust Islamic radicals.

The suspect was captured on camera offering a Muslim prayer in a corner of a busy shopping mall 10 minutes before he went after the soldier Saturday at the La Defense financial and shopping district, French prosecutor Francois Molins said.

The 22-year-old Frenchman identified only by his first name Alexandre, bought the juice and the pocketknife used in the attack an hour beforehand, Mr Molins said. "The intent to kill is obvious. The suspect doesn't hesitate to stab several times with impressive determination," he said.

The French soldier is recovering from his injuries and has been released from the hospital.

"The suspect implicitly confessed when he told police 'I know why you're here,'" Mr Molins said. "The nature of the attack, the fact that it happened three days after the London attack and a prayer that was carried shortly before the attack make us believe that he acted in the name of his religious ideology and that his wish was to attack someone representing the state. "

The suspect, who was unemployed and homeless, was identified through DNA he had left on a plastic juice bottle.

Mr Molins said the man came under scrutiny after a street prayer in 2007 and authorities had his DNA profile on record after a series of petty crimes as a minor. He converted to radical Islam around age 18.

Under French anti-terrorism law, he can be held for 96 hours without charge.

French security forces have been on heightened alert since the military intervened in the African nation of Mali in January to regain territory seized by Islamic radicals. Yet even before the French military action in Mali, French soldiers were considered possible targets at home by local radicals.

Last year, three French paratroopers were killed by a man police described as a French-born Islamic extremist. Mohamed Merah went on to attack a Jewish school in southern France, killing a rabbi and three Jewish children in March 2012 before being killed later that month in a gunbattle with police.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.