Three Americans, including two US service members, managed to overpower a gunman and thwart an attack on a high-speed train traveling from Amsterdam to Paris on Friday. The shooter has been identified as a 26-year-old Moroccan man with links to Islamist militant groups who had recently traveled to Syria.

Spencer Stone, a member of the Air Force stationed in the Azores, was slashed with a boxcutter while disarming the gunman. The Pentagon said his injuries were not life-threatening. A French-American citizen was also struck by a bullet during in the attack.

"It's important for me, together with the president of the republic and the prime minister, to express to the two American passengers who have been particularly brave and who acted during a very difficult situation, all our gratitude for what they did," French Interior Minister Bernard Cazeneuve said at a press conference on Saturday. "Without them we could have faced a terrible tragedy."

Chris Norman, a British businessman, also helped the Americans subdue the gunman. "He had a Kalashnikov, he had a magazine full, I don't know how many magazines he had," Norman told reporters, according to the Associated Press. "My thought was, okay, probably I'm going to die anyway. So, let's go. I'd rather die being active."

Video footage of the aftermath of the attack appears to show the Americans administering first aid to a bleeding passenger while the gunman lies hogtied on the floor of the train.

French counterterrorism police, who are leading the investigation with help from Belgian officials, are questioning the attacker. The man was reportedly under surveillance by Spanish authorities for his ties to radical groups, and Spanish authorities alerted their French counterparts to their concerns when the man left Spain for France in February 2014.

Stone was traveling with two childhood friends — Alek Skarlatos, a National Guardsman who had recently returned from a tour in Afghanistan, and Anthony Sadler, a senior at Sacramento State University — when the gunman burst into their train car near the city of Arras in northern France.

Anthony Sadler (left), Alek Skarlatos (center), and British man Chris Norman (right), after being awarded the medal of the city of Arras the day after they subdued a gunman on a train in northern France. (Photo by Frederic Leturque/Twitter/EPA)

Sadler told the AP that they saw a train employee run down the aisle trailed closely by a gunman with an automatic rifle.

"As he was cocking it to shoot it, Alek just yells, 'Spencer, go!' And Spencer runs down the aisle," Sadler said. "Spencer makes first contact, he tackles the guy, Alek wrestles the gun away from him, and the gunman pulls out a boxcutter and slices Spencer a few times. And the three of us beat him until he was unconscious."

Sadler also shared his account of the attack on Facebook:

According to Sadler, the gunman said nothing at all during the attack.

French actor Jean-Hugues Anglade, whose finger was reportedly cut "to the bone" as he broke emergency glass to sound the alarm, told the magazine Paris-Match that passengers thought they were going to die "because we were prisoners of this train." The Frenchman was traveling with his two children and a companion, and was one car away from where the gunman's attack was foiled.

"We were in a bad spot but with good people," Anglade said. "We were incredibly lucky to have American soldiers with us. I pay homage to their heroic courage and thank them. Without them, we all would be dead."

President Barack Obama, briefed on the attack Saturday morning, commended the Americans' swift response. "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," Obama said in a statement.

Follow Tessa Stuart on Twitter: __@tessastuart

The Associated Press contributed to this report.