Sarah Baron, a police union official in the city of Nice, said the attacker was detained after the attack. Nice Mayor Christian Estrosi said the attacker had an identity card with the name Moussa Coulibaly and a possible accomplice of his was also detained.
The surname, which is relatively common for families of Malian descent, is the same as that of the man who last month killed four hostages in a kosher supermarket in Paris and gunned down a policewoman.
Tuesday's attacker was armed with "two huge knives that actually resembled more a machete than a knife," said Philippe Pradel, a security official with Nice city hall, said on BFM television. "He freely attacked a soldier, but the knife was ineffective because the soldier was wearing a flak jacket. So then he tried to attack his face."
Another police official said the attacker pulled a knife at least 20 centimeters (8 inches) long out of a bag and set upon one of the soldiers, injuring him in the chin. He then swiped two other soldiers — one in the cheek, the other in the forearm — before being apprehended by riot police, the official said.
The attacker, aged about 30, had a record of theft and violence, the official said on condition of anonymity because the investigation was ongoing. His motive was not yet clear, the official added.
France has been on high alert since the attacks in Paris by three Islamic extremists that left 20 people dead, including the gunmen. More than 10,000 soldiers have been deployed around the country to protect sensitive locations, including major shopping areas, synagogues, mosques and transit hubs.
Earlier Tuesday, French authorities arrested seven men and a woman suspected of being involved in sending fighters to join Islamic extremists in Syria. Interior Minister Bernard Cazeneuve said, however, those arrested in the Paris and Lyon areas were not suspected of links to the Jan. 7-9 terror attackers in Paris.
Three of those arrested Tuesday had traveled to Syria and returned in December 2014, a French official said, though it was unclear whether they had joined the Islamic State group or another militant group. The network began sending French fighters to Syria in May 2013, and at least one of them was killed there, the official said.
The group did not appear to be involved in any particular plot, or linked to any other networks already broken up in France in recent months, said the official, who was not authorized to be identified discussing security matters.
France has seen hundreds of homegrown radicals join extremists abroad, most linked to the Islamic State group in Syria and Iraq.
Cazeneuve said recent atrocities by the Islamic State group — including the killing of a Japanese hostage — "only strengthen the government's determination to fight terrorism every day and every hour."
Associated Press writers Greg Keller contributed.
Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.