Two US Marines have overpowered a suspected terrorist who opened fire on a high-speed train travelling from Amsterdam to Paris.
“Without their courage we would have surely faced a terrible tragedy,” French interior minister Bernard Cazeneuve said.
US president Barack Obama also praised the actions of the US service members and other passengers who overpowered the suspect.
“The president expressed his profound gratitude for the courage and quick thinking of several passengers, including US service members, who selflessly subdued the attacker,” a White House official said.
“Their heroic actions may have prevented a far worse tragedy.”
One of the Marines was among three people injured in the attack, along with a Briton and a French actor.
The motives behind the attack were not immediately known, although French prosecutors said a probe was being launched by counter-terrorism investigators.
The French interior minister urged caution over the possible nature of the attack, which he said was a matter for the prosecutor to investigate.
“As always where an act that could be terrorist in nature is involved, the greatest care and the greatest precision will be used,” he said.
A spokesman for French rail company SNCF said two of the victims were seriously injured, and that at least one suffered gunshot wounds.
The heavily armed attacker was arrested after the train pulled into the station in the northern French town of Arras, the SNCF spokesman said.
“The passengers are safe, the situation has been brought under control,” train operator Thalys, which is partly owned by SNCF, said on Twitter.
Thalys said on its website several trains were delayed after the “intervention of security forces at Arras station”.
“The train is at the station and emergency services are at the scene,” Thalys said.
‘Gunman known to police’
According to the initial French investigations, the gunman was known to intelligence services and was Moroccan or of Moroccan origin and aged 26.
The man was carrying several weapons in his luggage, including guns and razor blades, one source close to the case told news agency AFP, with some reports he was armed with a Kalashnikov.
“The anti-terrorist section of the prosecutor’s office has taken this case, in agreement with the local prosecutor, in view of the weaponry used, the way it happened and the context,” the prosecutor’s office said.
Mr Cazeneuve went to Arras in the wake of the incident, which occurred shortly after 6:00pm on Friday (local time), his ministry said.
Earlier, his spokesman Pierre-Henry Brandet said the gunman’s motives were unknown and it was “too early to speak of a terrorist link”.
French president Francois Hollande said in a statement that “everything is being done to shed light” on the shooting.
French actor Jean-Hugues Anglade, who appeared in the 1986 cult film Betty Blue, was injured in the incident when he broke the glass to activate the train’s alarm, a witness said on condition of anonymity.
France has been on edge since an Islamist gunmen went on a rampage in January, killing 17 people in the capital Paris.
In June, a man beheaded his boss and tried to blow up a gas plant in southern France in what prosecutors say was an attack inspired by the Islamic State group.