A gunman armed with a Kalashnikov opened fire at passengers in a crowded train travelling from Amsterdam to Paris on Friday, injuring at three people. 

The shooting occurred on the high-speed Thalys train, but casualties were averted as passengers, including some off-duty American military men, overpowered the attacker. 

The attacker, a 26-year-old Moroccan, was then arrested by the police when the Amsterdam-Paris train stopped at Arras, AFP reported. He was found to be heavily armed with a Kalashnikov, an automatic pistol, cartridges and a knife. 

The shooting lasted "not more than 15 seconds", passengers recounted as the passengers managed to overpower him almost immediately. 

US President Barack Obama praised the American servicemen and the other passengers who thwarted what could have been a deadly attack, according to reports. 

However, two of those injured in the shooting are said to be in critical condition, France 24 reported. 

French authorities have refrained from calling the incident a terror attack so far. 

However, Belgian Prime Minister Charles Michel has gone ahead to refer the train shooting as a "terror attack". 

Among the passengers on the train were French actor Jean-Hugues Anglade, local media reported.