An operative for so-called Islamic State has gone on trial in Paris on terror charges for swaggering bare-chested through a train in 2015 with an arsenal of weapons and shooting one passenger.

Ayoub El Khazzani was brought down by three American tourists in an electrifying capture that Clint Eastwood turned into a Hollywood thriller.

The scene five years ago on the fast train from Amsterdam to Paris is the focus of the month-long trial of Khazzani, with evidence expected from the two US servicemen and their friend, who have been hailed as heroes.

With El Khazzani in court and watched by security officers, the trial opening on Monday was largely taken up with procedural issues including whether Eastwood's presence is needed.

That question was not immediately resolved.

The actor-director has so far not responded to a summons.

Eastwood turned the August 21 2015 drama in carriage No 12 into a film called The 15:17 To Paris.

El Khazzani, a 31-year-old Moroccan, spent several months in Syria and boarded the train in Brussels armed to the hilt, authorities say.

He is charged with attempted terrorist murder for the foiled attack.

If convicted, he faces a maximum sentence of life in prison.

Three others, who were not on the train, are also being tried for their roles as alleged accomplices.

Bilal Chatra, 24, an Algerian member of IS, would have been the second man on the train but dropped out of the plot a week earlier, it is alleged.

He had left Syria for Europe a week before to set up the exit route, prosecutors said.

Mohamed Bakkali allegedly took in the Europe-bound attackers in Budapest, Hungary, which he denies.

The two were arrested in Germany in 2016.

A third man, Redouane El Amrani Ezzerrifi, allegedly piloted a boat to help in their return to Europe.

The trial serves as a bridge to the massacre of 130 people in Paris three months later, on November 13 2015, at the Bataclan music hall and restaurants and cafes.

The man considered the likely mastermind of those attacks, Abdel Hamid Abaaoud, was the behind-the-scenes force of the train attack, planned in Syria, according to the prosecution.

Abaaoud travelled from Syria to Belgium with El Khazzani to organise attacks in Europe, and was holed up with him and Chatra in a Brussels apartment, according to the prosecution.

Abaaoud was killed by French special forces days after the Bataclan attack.

But before his death, his macabre organisational skills were at work in a failed plan to attack a church south of Paris in April 2015 that left a young woman dead.

Sid Ahmed Ghlam was convicted earlier this month and sentenced to life in prison.

El Khazzani "knowingly followed Abaaoud, but it's been years since he was in a jihadi mindset", his lawyer Sarah Mauger-Poliak said in a phone interview.

"He is very affected and regrets having allowed himself to become indoctrinated in propaganda."

The propaganda evolved into a plot to allegedly kill trapped passengers.

El Khazzani bought a train ticket at the Brussels station on August 21 2015 for a 5.13pm departure.

He was armed with a Kalashnikov, nine clips with 30 rounds each, an automatic pistol and a cutter, according to investigators.

Once on the train, he lingered in a toilet between carriages and emerged bare-chested with a Kalashnikov, they said.

One waiting passenger struggled with the attacker, then a French-American, Mark Magoolian, wrestled the Kalashnikov away - before being shot himself by a pistol as he headed to carriage No 12 to warn his wife.

Mr Magoolian said in interviews later that the attacker recovered the Kalashnikov.

Spencer Stone, a then-23-year-old US airman, said days after the attack that he was coming out of a deep sleep when the gunman appeared.

Alek Skarlatos, then a 22-year-old US National Guardsman recently back from Afghanistan, "just hit me on the shoulder and said, 'Let's go'".

The three men, all from California, snapped into action out of what Mr Skarlatos said at a news conference days later was "gut instinct".

Mr Stone and Mr Skarlatos moved in to tackle the gunman and take his gun.

The third friend, Anthony Sadler, 23, then a student, helped subdue the assailant.

Mr Stone said he choked El Khazzani unconscious.

A British businessman then joined in the fray.

Mr Stone, whose hand was injured by the cutter, is also credited with saving the French-American teacher whose neck was squirting blood.

Mr Stone said he "just stuck two of my fingers in his hole and found what I thought to be the artery, pushed down and the bleeding stopped".

The train rerouted to Arras, in northern France, where El Khazzani was arrested.

El-Khazzani had left Morocco aged 18 to join his family in Spain.

In 2012, he established links with radicals.

He went to Brussels before heading to Turkey, a gateway to Syria.

A watch list signal "sounded" on May 10 2015 in Berlin, where El-Khazzani was flying to Turkey, then-French interior minister Bernard Cazeneuve had said.

El Khazzani told investigators that Abaaoud wanted him to kill only the American military men, a line he was likely to maintain during the trial.

The investigating judges consider it a dubious claim, in part because their presence on the train could not be known in advance and they were in civilian clothes.

That defence also fails to chime with Abaaoud's goal of killing a maximum number of people during attacks.