A Moroccan man and three alleged accomplices have gone on trial in France for an attempted terror attack on an Amsterdam-Paris train five years ago that was foiled by passengers whose heroic actions were turned into a Hollywood film.

Director Clint Eastwood, 90, is on the witness list for the trial in Paris, scheduled to last until 17 December.

It is believed his 2018 film 'The 15:17 to Paris' will serve as a reconstruction of the events of 21 August, 2015.

Gunman Ayoub El Khazzani was tackled by passengers shortly after emerging bare-chested and heavily armed from a toilet on a Thalys high-speed train.

There were around 150 passengers in the carriage with Khazzani, who had an AK47 slung over his back, and a bag of nearly 300 rounds of ammunition.

One of them, Franco-American professor Mark Moogalian, grabbed Khazzani's assault rifle as he emerged.

The attacker took a pistol out of his belt, shot and wounded Professor Moogalian, and reclaimed the AK47 only to be tackled afresh and disarmed by two US soldiers - Spencer Stone and Alek Skarlatos - who heard the commotion from a neighbouring carriage.

The soldiers were aided by their friend Anthony Sadler, with whom they were backpacking through Europe.

Stone was slashed in the neck and on an eyebrow and almost had his thumb sliced off with a box-cutter wielded by Khazzani.

Spencer Stone was injured in the 2015 attack

"He had 270 rounds of ammunition on him, enough to kill 300 people," according to Thibault de Montbrial, the lawyer for the three Americans.

The lawyer argues there was no doubt his clients had prevented a "mass attack".

Khazzani, who joined the so-called Islamic State group in Syria in May 2015, is charged with "attempted terrorist murder". 

The 31-year-old appeared in court, confirming his identity to the judges and stating his former profession in "patisserie" (pastry).

A courtroom sketch shows Ayoub El Khazzani in the dock

He was joined in the dock by three men facing charges for aiding and abetting the crime: Bilal Chatra, Redouane Sebbar and Mohamed Bakkali.

Also present in court to face his attacker was Prof Moogalian, accompanied by his wife.

The train assault happened in the same year as the 15 December massacre of staff at the Charlie Hebdo satirical magazine, the killing of a policewoman, and a deadly hostage siege at a Jewish supermarket - three days of violence that left 17 dead.

In November the same year, jihadists armed with assault rifles and explosives struck simultaneously outside the national stadium, Paris cafes and the Bataclan concert hall, killing 130 people and wounding more than 350 in France's deadliest peace-time attack.

Co-accused Chatra is charged with having acted as an advance scout for Khazzani to get into Europe via the migrant trail from Syria. 

The other two are accused of having helped Khazzani and Belgian Abdelhamid Abaaoud - believed to have been one of the masterminds behind the Thalys and 13 November attacks - to enter Europe and set up a jihadist cell.

Police killed Abaaoud after he shot indiscriminately at packed cafe terraces in Paris on the night of the coordinated attacks, for which Bakkali is also accused of having acted as logistics coordinator.

The three Americans, who along with Prof Moogalian played themselves in Eastwood's film, would attend the trial on Thursday and Friday this week, days set aside for witness testimony from train passengers, the court heard.

Professor Mark Moogalian was shot after he grabbed the gunman's AK47

The trial comes at a time of heightened security alert in France following three attacks blamed on jihadists in a month - a knife attack outside Charlie Hebdo's former offices, the beheading of a history teacher, and a deadly stabbing spree at a church in Nice.

Khazzani does not deny having boarded the train with the intent of committing an attack, but claims to have had a change of heart at the last minute, too late to avoid the confrontation with the Americans.

(L-R) Alek Skarlatos, Spencer Stone and Anthony Sadler at an awards ceremony in the US    

His lawyer Sarah Mauger-Poliak says Khazzani is a changed man who has rejected radical Islamist doctrine and regrets his actions.