An attempted attack by a heavily armed man on a train in France last week was premeditated and well prepared, according to a French 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.
Prosecutors have now filed formal charges against him.
Mr Khazzani is accused of carrying out a "targeted and premeditated" jihadist attack.
He is also accused of firearms offences and "participation in a terrorist association with a view to organising one or several damaging crimes," according to prosecutors' documents quoted by the AFP news agency.
He was overpowered by passengers on the Thalys express train from Amsterdam to Paris on Friday. No-one died.
Three Americans and one Briton who overpowered the gunman were awarded medals for their bravery.
A US-born Frenchman, Mark Magoolian, and another unnamed Frenchman will also be given awards later for trying to tackle the gunman.
"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.
Mr Molins said Mr 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 Mr Khazzani's explanation became less and less clear during questioning and eventually he stopped talking to investigators altogether.
Analysis: Hugh Schofield, BBC News, Paris
The most important thing we learned from the Paris prosecutor's news conference was that Ayoub El-Khazzani fired himself up for his attack with a jihadist propaganda video.
This is a crucial piece of evidence that convinced the prosecutor's office to proceed with terrorist-related charges.
El-Khazzani has tried to argue that his motivations were purely criminal, but his interrogators do not believe a word of it.
The other evidence includes his known past extremist links in Spain; the size of his arsenal; and his unlikely explanations given under questioning about finding the weapons in a park.
Mr Khazzani's phone, which was found in a bag on the train, had been activated on the day of the attack, Mr Molins said.
He boarded the Amsterdam-Paris train in Brussels and ticket sellers at the station said he paid for a first-class ticket in cash and turned down an earlier train.
Mr Molins said this was an indication the target had been carefully chosen in advance.
As well as the Kalashnikov assault rifle, ammunition, and petrol, he was also carrying a Luger pistol and a box-cutter, according to the prosecutor.
Officials say Mr Khazzani is originally from Tetouan in northern Morocco.
He reportedly moved to Spain in 2007 and lived there for seven years, in Madrid and Algeciras, before relocating to France then Belgium.
In Spain, he is said to have come to the attention of authorities for making comments defending jihadists and attending a radical mosque in Algeciras. He was also reportedly involved in drug trafficking.
Mr Khazzani told police he had been living rough in Belgium before the attack, but investigators believe he was staying with his sister in Brussels.
Police in the city searched two buildings in the Molenbeek-Saint-Jean neighbourhood on Monday where Mr Khazzani may have stayed.
A statement from the Belgian Federal Prosecutor's Office said no-one had been detained but "some objects" had been seized for further examination. No further detail was given.