The Moroccan man who opened fire in the Thalys between Amsterdam and Paris in 2015 was sentenced to life by a French court on Thursday.

The sentence is in accordance with the prosecutors' demand, French media report.

Gunman Ayoub El Khazzani stepped out of a toilet on the high-speed train on August 21, 2015, heavily armed.

American passenger Mark Moogalian intervened and grabbed his AK-47, after which El Khazzani started firing a pistol.

He wounded the American, but was subsequently disarmed by three other Americans, who were backpacking at the time.

The 31-year-old man had enough ammunition to kill three hundred people, according to the French prosecution.

The trial of the shooter and his three alleged accomplices began in November.

El Khazzani expressed regret in court for his action last Tuesday.

He admitted that he intended to carry out an attack, but said he changed his mind at the very last minute.

According to him, it would have been too late by then to avoid a confrontation with passengers.

The man was led by Abdelhamid Abaaoud, who is the mastermind behind the bloody series of radical Islamic attacks in Paris in November 2015, in which more than 130 people were killed.

Abaaoud was killed in a shootout after a police raid after the attacks.

Three of El Khazzani's accomplices were sentenced to sentences between 7 and 27 years on Thursday.

One of those accomplices, 33-year-old Belgian Mohamed Bakkali, was sentenced to 25 years in prison.

He is also suspected of involvement in the attacks in Paris on November 13, 2015.