Police officers investigate after a man wielding a knife attacked residents venturing out to shop in the town under lockdown, Saturday April 4, 2020 in Romans-sur-Isere, southern France. The alleged attacker was arrested by police nearby, shortly after the attack. Prosecutors did not identify him. They said he had no documents but claimed to be Sudanese and to have been born in 1987. Police officers gather after a man wielding a knife attacked residents venturing out to shop in the town under lockdown, Saturday April 4, 2020 in Romans-sur-Isere, southern France. The alleged attacker was arrested by police nearby, shortly after the attack. Prosecutors did not identify him. They said he had no documents but claimed to be Sudanese and to have been born in 1987. Police officers patrol after a man wielding a knife attacked residents venturing out to shop in the town under lockdown, Saturday April 4, 2020 in Romans-sur-Isere, southern France. The alleged attacker was arrested by police nearby, shortly after the attack. Prosecutors did not identify him. They said he had no documents but claimed to be Sudanese and to have been born in 1987. A police officer gives a phone call after a man wielding a knife attacked residents venturing out to shop in the town under lockdown, Saturday April 4, 2020 in Romans-sur-Isere, southern France. The alleged attacker was arrested by police nearby, shortly after the attack. Prosecutors did not identify him. They said he had no documents but claimed to be Sudanese and to have been born in 1987. Police officers investigate after a man wielding a knife attacked residents venturing out to shop in the town under lockdown, Saturday April 4, 2020 in Romans-sur-Isere, southern France. The alleged attacker was arrested by police nearby, shortly after the attack. Prosecutors did not identify him. They said he had no documents but claimed to be Sudanese and to have been born in 1987.

France's counter-terrorism prosecutor’s office said the assailant was arrested near the scene of the attack in the town of Romans-sur-Isere, south of Lyon, as he was kneeling on the sidewalk praying in Arabic. It said one of his acquaintances also was 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.

The prosecutor’s office did not confirm reports that the man shouted “Allahu akbar” (God is great) as he stabbed and slashed people. Like the entire population of France, Romans-sur-Isere's residents have been ordered to stay home except for a few exceptions. The victims were doing their food shopping, one of the permitted outside activities, on the street that has bakeries and grocery stores, the prosecutor's office said.

French media reported that the knifeman first attacked a man who had just left home for a daily walk — slitting his throat in front of the victim's girlfriend and son. Next, the assailant went into a tobacco shop, stabbed the tobacconist and two customers, and then went into the local butcher’s shop, according to French news reports.. He grabbed another knife and attacked a customer with the blunt end before entering a supermarket, the media said..

Some shoppers took refuge in a nearby bakery. French Interior Minister Christophe Castaner arrived at the scene in the town south of Lyon within hours and thanked shopkeepers for their help. Some 100 police and 45 firefighters were involved in the operation and securing the area, authorities said.

There have been a number of knife attacks in France in recent months. In January, French police shot and injured a man in Metz who was waving a knife and shouting “Allahu akbar.” Two days earlier, another man was shot dead by police after he stabbed one person fatally and wounded two others in a Paris suburb.

It is unclear whether the suspect in Saturday’s attack had psychological problems or any links to extremism. Analysts say some extremist groups see the upheaval from the virus pandemic as an opportunity to win over more supporters.

Angela Charlton in Paris contributed.