A gunman overpowered by passengers on a train in France on Friday was known to European authorities as a suspected Islamist militant, provided the identity he has given interrogators is correct, France's interior minister Bernard Cazeneuve said yesterday.

Two people were wounded in the struggle to subdue the Kalashnikov-toting attacker aboard the high-speed train from Amsterdam to Paris.

Two of three American men who overpowered the gunman, Spencer Stone and Alek Skarlatos, are members of the US Air Force and the National Guard respectively.

They were travelling on the train on Friday evening with a childhood friend, Anthony Sadler, a student at Sacramento State University in California who also helped restrain the attacker. Spencer Stone suffered knife wounds and another man who has not been identified, was badly wounded in the neck.

Chris Norman, a British man living in France, was also hurt while trying to subdue the attacker.

"We heard a gunshot, and we heard glass breaking behind us, and saw a train employee sprint past us down the aisle," Sadler said.

They saw a gunman entering the train car with an automatic rifle, he said.

"As he was cocking it to shoot it, Alek just yells, 'Spencer, go!' And Spencer runs down the aisle," Sadler continued.

"Spencer makes first contact, he tackles the guy, Alek wrestled the gun away from him, and the gunman pulls out a box cutter and slices Spencer a few times. And the three of us beat him until he was unconscious."

President Barack Obama expressed his gratitude on Friday for the "courage and quick thinking" of the passengers.

The White House issued a statement saying that Obama was briefed on the shooting, and said: "While the investigation into the attack is in its early stages, it is clear that their heroic actions may have prevented a far worse tragedy."

The French authorities yesterday began to reveal more details about the attacker but remained guarded.

"It is important to be careful about his identity which is not yet established with certainty," said interior minister Bernard Cazeneuve.

"If the identity he has declared is confirmed, he is a 26-year-old man of Moroccan nationality identified by the Spanish authorities to French intelligence services in February 2014 because of his connections to the radical Islamist movement."

He said inquiries in collaboration with other European authorities "should establish precisely the activities and travels of this terrorist".

Spain's interior ministry could not immediately be reached for comment.

A source with knowledge of the case, speaking on condition of anonymity, said the gunman had originally given a different identity which was unknown to the security services.

Cazeneuve said the attacker had a Kalashnikov assault rifle, an automatic pistol with accompanying ammunition clips and a box cutter knife. He said the struggle started when a Frenchman on his way to the toilet tried to stop the man entering a carriage.

The minister said the second person hurt was of Franco-American nationality, hit by a bullet while seated. Authorities said that French actor Jean-Hugues Anglade, the star of Betty Blue and Nikita, was lightly wounded breaking glass to sound the alarm.

French authorities have been on high security alert since January, when 17 people were killed in shootings by Islamist militants in and around Paris.

The man the attacker claims to be lived in Spain during 2014 and in Belgium in 2015, Cazeneuve said.

According to Le Voix du Nord, citing security sources, the suspected Islamist militant was seen on a plane to Turkey from Germany in May, and was thought to have visited Syria.

The French newspaper said he may have had connections to a group involved in a suspected Islamist shooting in Belgium in January.

The wounded US serviceman was expected to be treated at a specialist hospital for people with hand injuries in the northern French city of Lille.

President Francois Hollande's office said he would receive the passengers who subdued the gunman to thank them in the coming days.

The gunman has been transferred to the Paris region from Arras in northern France where the incident took place.

Cazeneuve said under the terms of his arrest the man can be held for four days without being charged.

The shooting took place on a Thalys high-speed train. Thalys is partly owned by French state transport group SNCF and by Belgian railways. It runs international trains joining France, Belgium, the Netherlands and Germany.

All four countries are part of the Schengen area through which people travel without the need for passports and security check-ins. Experts have long said the trains are a potential target for attacks.