French President Francois Hollande has thanked three American men hailed as heroes for overpowering a heavily-armed gunman on a train in northern France.
The incident happened on the high-speed Thalys service near Arras on Friday. A 26-year-old Moroccan man was arrested.
One of the Americans said they took an AK-47 assault rifle and a handgun from the attacker as they saw him walk down the aisle of the train.
One of the Americans and another passenger were seriously hurt.
In a press conference on Saturday, French Interior Minister Bernard Cazeneuve said the suspect's identity had yet to be confirmed, but it was believed that he had radical Islamist beliefs.
Two of the American men who overpowered the gunman, Spencer Stone and Alek Skarlatos, are members of the Air Force and the National Guard respectively.
They were travelling on the train from Amsterdam to Paris on Friday evening with a childhood friend, Anthony Sadler, who also helped restrain the attacker.
Interior Minister Bernard Cazeneuve: "[The suspect's] details were flagged up to the French authorities... in February 2014."
When a French passenger tried to enter a toilet on the train, he encountered the gunman, tried to overpower him and the gun was then fired, Mr Cazeneuve said.
A French-American passenger was injured by the bullet, and the American passengers intervened shortly afterward, he said.
"Spencer got to the guy first and grabbed the guy by the neck," Mr Skarlatos told Sky News.
"I grabbed the handgun, got that away from the guy and threw it. Then I grabbed the AK-47, which was at his feet, and started muzzle-bumping him in the head with it.
"Everybody just started beating the guy while Spencer held the chokehold until he went unconscious."
Scene-of-crime experts were quickly summoned
When he checked the AK-47, Mr Skarlatos said it had jammed and would not have been able to fire. The cartridge for the handgun had also been dropped, he said.
Mr Sadler said: "I came to see my friends on my first trip in Europe, and we stopped a terrorist. Kinda crazy."
Mr Cazeneuve said Mr Hollande had thanked the men by telephone and will meet them in the coming days.
Chris Norman, a British man living in France, was also hurt while trying to subdue the attacker.
"I came in at the end of it all and helped get him under control," he said at a news conference in Arras.
Anthony Sadler's father Tony says he is "still wrapping his head around" events of the past 24 hours
"The guy pulled out a cutter and started cutting Spencer - he cut behind his neck and nearly cut his thumb off."
The second seriously injured man, who has not been identified, suffered severe cuts to his neck. Spencer Stone went to help him despite his own injuries. Mr Stone remains in hospital.
"I'm really proud of my friend that he just reacted so quickly and so bravely," Anthony Sadler said.
"He was really the first one over there. Even after being injured himself, he went to go help the other man who was bleeding also. Without his help, he would have died.
"That man was bleeding from his neck profusely."
French actor Jean-Hugues Anglade, who was on board, said: "I thought it was the end"
The 554 passengers included French actor Jean-Hugues Anglade, the star of Betty Blue and Nikita, who was lightly wounded breaking glass to sound the alarm.
In an interview with Paris Match magazine, Mr Anglade said train staff entered a private cabin and locked it when they heard gunshots, leaving the passengers alone.
"I thought it was the end, that we were going to die, that he was going to kill us all," he said.
"I really could see us all dying because we were all prisoners in that train, it would have been impossible to escape from that nightmare."
The American men and Mr Norman were awarded medals for bravery by authorities in Arras.
In a statement, British Prime Minister David Cameron praised the "extraordinary courage of the passengers who intervened and helped disarm the gunman, including the British consultant Chris Norman".
"The bravery of Mr Norman and the other passengers helped to prevent a terrible incident," he said.
US President Barack Obama also praised those who took action.
"It is clear that their heroic actions may have prevented a far worse tragedy," the White House said in a statement.
Mr Cazeneuve said the suspect had lived in Spain until 2014, and in Belgium this year.
Spanish intelligence passed on information about the suspect to France in February 2014, he said.
Anti-terror investigators in Paris now have 96 hours to question the suspect.
Belgian prosecutors also opened an anti-terror investigation on Saturday morning.
France has been on edge since the attack on the Charlie Hebdo magazine and a Jewish supermarket in Paris in January, which left 17 people dead.
Source: The BBC