An attempted attack by a heavily armed man on a train in France last week was premeditated and well prepared, according to aFrench prosecutor.
Ayoub El-Khazzani, 25, was carrying 270 bullets for his assault rifle and a bottle of petrol, prosecutor Francois Molins told reporters on Tuesday.
The Moroccan's phone showed that he had watched a jihadist video shortly before launching the attack, Mr Molins added.
He was overpowered by passengers on the Thalys train on Friday. No-one died.
Three Americans and one Briton who tackled the gunman were awarded medals for their bravery.
"Ayoub El-Khazzani had watched YouTube audio files whilst already on the Thalys train in which an individual called on the faithful to fight and take up arms in the name of the Prophet [Muhammad]," Mr Molins told a news conference.
He said a formal terrorism investigation had been opened, adding that other European authorities had passed on information about the suspect's travels and links to radical Islam.
Investigators are expected to file several charges against him, including multiple attempted murders in connection with terrorism.
Under French law, the charges must be filed by Tuesday night unless authorities obtain a special extension to his temporary custody.
Mr Molins said El-Khazzani was "known for his radicalism" and had recently travelled to Turkey - "a possible route to Syria".
The suspect is said to have denied plotting a terrorist attack, saying he found a bag of weapons the night before and planned to use them to rob passengers.
But the prosecutor said El-Khazzani's explanation became less and less clear during questioning before the suspect stopped talking to investigators altogether.