Jean-Claude Gaudin, the mayor of Marseille, told reporters that the attacker had seemed to have âseveral identities.â
Asked about reports that the attacker yelled âAllahu akbar,â or âGod is greatestâ in Arabic, at the moment of the attack, Mr. Collomb said that âa certain numberâ of witnesses had said they heard him do so, but he added that they were still being interviewed by the police for further details.
âWe have video images that will enable us to assess the situation,â Mr. Collomb said, referring to security camera footage in the station. âWhat is strange on the video is that the person starts to commit his crime on a first person, then he runs away, and then he turns back to kill the second person.â
A military patrol that had rushed to the scene after hearing cries of panic and seeing people running fired warning shots at the attacker, Mr. Collomb said, and then shot and killed him when he rushed at them.
Soldiers and armed police officers with protective gear barred access to the train station for much of Sunday afternoon, and the national railway operator urged travelers to avoid the station, but the authorities said later in the day that train service was slowly returning to normal.
France has been on high alert for acts of terrorism since 2015, after a string of attacks that killed more than 230 people. The deadliest attack was an assault in November 2015 by coordinated teams of Islamic State operatives who killed 130 people in and around Paris, prompting officials to declare a state of emergency.
The state of emergency, which enables the authorities to raid homes and place people under house arrest without the authorization of a judge, has been renewed several times and will end on Nov. 1.
But Parliament is expected to vote soon on a bill that would give security forces additional powers, some similar to those in the state of emergency, to monitor suspects, conduct raids and search bags or vehicles. Civil rights groups have criticized the legislation.
In a statement on Sunday evening, Ãdouard Philippe, the French prime minister, expressed âanger and outrageâ after the attack and praised the soldiers who had âneutralized the criminal and stopped his killing spree.â
âWe will not drop our guard,â Mr. Philippe added on Twitter.
So far in 2017, there have not been large-scale attacks like the ones that struck Paris in 2015 and Nice in 2016, but France has grown wearily accustomed to smaller, sporadic attacks, especially against police officers and soldiers patrolling sensitive or crowded sites.
In September, a man wielding a knife was arrested after he attacked a military patrol in one of the biggest metro stations in Paris; but no one was injured. In August, a driver plowed into a military patrol in Levallois-Perret, a suburb just north of the capital, injuring six soldiers.
Other attacks have been carried out by mentally ill residents, who sometimes imitate acts of terrorism, according to officials.
In August, a man with a history of psychiatric disorders rammed a vehicle into two bus stops in Marseille, killing one woman, but the authorities said the episode was not related to terrorism.
In September, four American college students traveling through the Saint-Charles station were attacked with acid by a psychologically disturbed woman, officials said.