Two French soldiers were slightly injured in an attack by a knife-wielding man in the southern resort of Nice on Tuesday, close to a Jewish community centre.
No motive has been offered for the attack, which the justice ministry is treating as a terrorist act.
However, it appears the man had just left a tram on which he had been fined for not buying a ticket.
“He was carrying identification documents with him that didn’t give his identity, but bore the name Moussa Coulibaly,” said the Mayor of Nice, Christian Estrosi.
“A few moments later we arrested a second man who seems to be his accomplice.”
French police say the attacker was apprehended by a tram guard and a shopkeeper.
They say he had a string of previous convictions for theft and drug offences.
He had also been interviewed previously by the secret service after the Turkish authorities reported he had tried to enter the country on a one-way ticket.