Two women were stabbed to death and their assailant shot dead in the southern port city of Marseille on Sunday in what French police described as a "likely terrorist act".
Police sources said the suspect had shouted "Allahu Akbar" (God is greatest) in Arabic as he attacked the women, aged 17 and 20, at Marseille's main railway station.
Two police sources said one had her throat slit while the other was stabbed in the chest and stomach.
A witness said she saw a man take a knife from his sleeve and stab a young girl and then a woman.
She said soldiers from France's Operation Sentinelle unit, who were patrolling nearby, attended the scene. Sentinelle is the French military's anti-terrorism branch that has been deployed since the 2015 attacks in Paris. The unit has some 10,000 soldiers and more than 4700 police officers.
"We have until now managed to avoid such dramatic incidents [in Marseille]. I think it was a terrorist attack and the individual who was killed seems to have had several identities," Marseille Mayor Jean-Claude Gaudin told reporters.
Regional president Renaud Muselier praised the emergency response.
"We have generally avoided these sort of attacks in Marseille," he told BFM TV from the scene of the attack.
"I think the security services responded extremely quickly. It's difficult to do more because when you see the distance between the two bodies and the attacker it's only 10 metres, so they intervened quickly."
France's counter-terrorism prosecutor has opened an investigation into the attack, a judicial source said.
Police cordoned off the area and closed Marseille Saint-Charles, the city's main train station. Many trains were cancelled and people were told to avoid the area.
French Interior Minister Gerard Collomb said on Twitter he would be immediately going to the site of the attack.
Speaking in Marseille, Interior Minister Gerard Collomb said the man had initially killed one woman and looked to be running away before returning to attack a second woman and then rush towards soldiers from the Sentinelle force who arrived on the scene quickly and shot him dead.
Two police sources said the attacker had been carrying a butcher's knife, was around 30 years old and of North African appearance. One source said he was known to police for common law crimes, while another said digital analysis of fingerprints had come up with several aliases.
"This could be an act of terrorism, but we cannot confirm it fully at this stage," Collomb said.
French troops are part of a US-led coalition fighting Islamic State in Syria and Iraq and has thousands of soldiers in West Africa fighting al-Qaeda-linked militants, operations that have made these groups urge their followers to target France.
Security forces have increasingly been targeted by militants in knife attacks. A man wielding a knife attacked a soldier in a Paris metro station on September 15.
President Emmanuel Macron said on Twitter he was "disgusted by this barbaric act" and praised the calmness and efficiency of security forces.
French lawmakers are due to vote on a much-criticised anti-terrorism law on Tuesday, which would see France come out of its state-of-emergency in November, although some of the powers would be enshrined into law.
The number of military personnel on the ground is also due to be reduced slightly, although the force is being adapted to make it more mobile and its movements less predictable.
"The presence of Sentinelle soldiers, their speed and efficiency ensured that the death count was not bigger," police union official Stephane Battaglia said.