Shouting “Allahu akbar” (God is greatest), the 24-year-old woman struck a customer waiting at the checkout, as well as a cashier who tried to intervene on Sunday morning at a supermarket in Seyne-sur-Mer, near the Mediterranean port of Toulon.
Both victims were taken to hospital, but their wounds were not life-threatening.
The assailant, who did not have a police record, was overpowered by other people in the supermarket and taken into custody.
France has been on high alert following a string of jihadist attacks since early 2015, often by people who have become radicalised or claim to have acted in the name of the Islamic State group.
According to witnesses, the woman claimed to be “Allah's fiancee”. And the Toulon prosecutor's office said Tuesday that she had had trouble explaining her motive for the attack, which she had apparently decided on earlier that morning.
“Several witnesses report that she had said that Allah told her to do it, that they were all non-believers and that she wanted police to kill her,” the prosecutor's office said.
Local prosecutor Bernard Marchal had told AFP on Sunday that “it appears to be an isolated case by a person with known psychological problems,” but added that “that doesn't exclude the possibility that she may have been radicalised.”
The Paris prosecutor, who deals with terrorism cases, is not taking the case, Marchal said.
More than 240 people have been killed in jihadist attacks since the massacre at the Charlie Hebdo satirical magazine in Paris in January 2015.
Last month a knifeman shouting “Allahu akbar” killed one person and wounded four others during a Saturday night attack in a bustling Paris neighbourhood.