But the incident, which took place on Friday evening in the town of Valence, was not being treated as terror-related due to insufficient evidence, prosecutor Alex Perrin told reporters.
"The terrorism line of investigation has been ruled out for now," he said.
The 29-year-old suspect, a French citizen of Tunisian origin, had told investigators "he wanted to be killed by the soldiers and kill the soldiers", the prosecutor said.
"This appears to be someone who acted alone and had no particular link to any movement," Perrin said.
The suspect was "rather confused" and claimed he had targeted the soldiers "because they kill people", he added.
Witnesses said the driver deliberately accelerated his Peugeot car as he headed towards a group of four soldiers in a car park outside a large mosque in a suburb of Valence.
The driver bore down on the team a first time, prompting them to shout a warning, and when he returned for a second pass, they opened fire, injuring him in the arm and the leg.
One of the soldiers sustained leg injuries after being hit by the vehicle, and a 72-year-old worshipper was also hurt after being hit in the leg by a stray bullet.
France is on high alert following the November 13 attacks on Paris in which 130 people died when gunmen and suicide bombers attacked bars and restaurants, a concert hall and the Stade de France national stadium.
More than 10,000 soldiers are deployed across France to guard premises including mosques and synagogues.