Two people have died and five others were injured after a knife attack outside a bakery in southern France.

Police were called to a bakery in the town of Romans-sur-Isere around 11am on Saturday and arrested a man at the scene.

Local reports say the suspect is a 33-year-old Sudanese national and cite witnesses who claim he shouted "Allahu akbar" before the attack.

France's counter-terrorism prosecutor's office said the suspect was arrested near the scene of the attack in the town of Romans-sur-Isere, south of Lyon, as he was kneeling on the pavement praying in Arabic.

It said one of his acquaintances was also detained.

Prosecutors did not identify the suspect.

They said he had no identifying documents but claimed to be Sudanese and to have been born in 1987.

During a subsequent search of his home, authorities found handwritten documents that included arguments about religion and a complaint about living in a "country of unbelievers", officials said.

At least one of the surviving victims was described as being in a critical condition and several others are in a serious condition.

The knifeman is said to have attacked the manager and two customers before continuing his rampage on the street, France Bleu reported.