"We have opened an inquiry under the anti-terrorism law ... as the suspect boarded the train in Brussels," Eric Van der Sypt, a spokesman for the prosecutor's office, told news agency AFP Saturday.
French authorities say three people were injured, two of them seriously - one with a gunshot wound, the other a knife wound.
Three American men are being hailed as heroes for overpowering the heavily-armed gunman, taking an AK-47 assault rifle and a handgun from the attacker as they saw him walk down the aisle of the train.
They then put him in a chokehold until he was unconscious.
Besides the Kalashnikov assault rifle and an automatic pistol, the gunman was carrying nine cartridge clips and a box-cutter, which he reportedly sliced one of the American man with during the struggle.
The train, which was travelling from Amsterdam, stopped in the town of Arras in northern France where the suspect was handed over to French police.
The suspect is thought to be a 26-year-old of Moroccan origin who had lived in Spain, sources close to the French investigation told AFP.
He was known to the French authorities after being flagged as a potential jihadist by Spanish intelligence services.
Spanish daily El Pais said he moved to France last year and had visited Syria.
French prosecutors said late Friday that counter-terrorism investigators had taken over the French side of the probe.
The American men, two who are reportedly soldiers in the US Air Force and National Guard, and a British man living in France were awarded medals for bravery by authorities in Arras.
US President Barack Obama was among those to praise those who took action.
"The president expressed his profound gratitude for the courage and quick thinking of several passengers, including US service members, who selflessly subdued the attacker," the White House said in a statement.
"It is clear that their heroic actions may have prevented a far worse tragedy."
French Interior Minister Bernard Cazeneuve said the passengers were "particularly courageous and showed great bravery in very difficult circumstances", adding: "Without their composure we could have been confronted with a terrible incident."
France has been on high alert since Islamist gunmen went on a rampage in January, killing 17 people in Paris.