PARIS (AFP) -- A heavily-armed gunman previously flagged by intelligence services who was overpowered by passengers in a crowded train said he was "dumbfounded" by accusations of terrorism levelled against him, his lawyer said Sunday.
The alleged attacker, named as 25-year-old Moroccan national Ayoub El Khazzani, on Friday evening boarded a high-speed train in Brussels bound for Paris armed with a Kalashnikov assault rifle, Luger automatic pistol, nine cartridge clips and a box-cutter.
Witnesses say he opened fire, injuring a man before being wrestled to the floor by three American passengers and tied up, until the train stopped in the northern French city of Arras where he was taken into police custody.
Khazzani has denied any intention of waging a jihadist attack, saying he had merely stumbled upon a weapons stash and decided to use it to rob passengers, according to Sophie David, a lawyer assigned to his case at the beginning of his detention in Arras.
"He is dumbfounded that his act is being linked to terrorism," she told BFM-TV, adding the suspect who is believed to have lived in Belgium describes himself as a homeless man.
"He says that by chance he found a suitcase with a weapon, with a telephone, hidden away," said David, who is no longer representing him as Khazzani has been transferred to Levallois Perret near Paris where he is being questioned by counter terrorism officers.
"He said he found it in the park which is just next to the Midi Station in Brussels, where he often sleeps with other homeless people."
"He says that the Kalashnikov didn't work and he was brought under control immediately without a single shot being fired," David added.
Intelligence services in several countries had nevertheless previously flagged him as a radical Islamist, and French investigators are focussing on an extremist attack.
Armed with the weapons, the attacker exited a toilet cubicle on the high-speed train just after it crossed from Belgium into northern France.
A French passenger who happened to be there tried to disarm Khazzani -- described as "small, slim, not very strong" -- but he got away and fired at least one shot, wounding a Franco-American traveller in his 50s.
But the attack was quickly stopped when two off-duty US servicemen and their friend charged the gunman and restrained him.
"I looked back and saw a guy enter with a Kalashnikov. My friends and I got down and then I said 'Let's get him'," Alek Skarlatos, a 22-year-old member of the National Guard in Oregon who recently returned from Afghanistan, told France's BFMTV.
Spencer Stone, who serves in the US Air Force, was first to the gunman, who slashed him in the neck and almost sliced off his thumb with a box-cutter.
"At that point I showed up and grabbed the gun from him and basically started beating him in the head until he fell unconscious," said Skarlatos.
His friend Anthony Sadler, a 23-year-old student at Sacramento State University, and a British business consultant, Chris Norman, then helped keep the man subdued.
French President Francois Hollande is to thank the group for their courage at the Elysee Palace on Monday.
A Spanish counter-terrorism source said Khazzani had lived in Spain for seven years until 2014.
During his time in Spain, he came to the attention of authorities for making hardline speeches defending jihad, and was once detained for drug trafficking, according to the source.
Spanish intelligence services say he went to France, from where he travelled to Syria, but the suspect has reportedly denied going to the conflict-ridden country where the Islamic State group controls swathes of territory.
A source close to the French probe, meanwhile, said he "lived in Belgium, got on the train in Belgium with weapons likely acquired in Belgium. And he had identity papers issued in Spain."
French Interior Minister Bernard Cazeneuve said Spanish intelligence services had tipped off France over his ties to "radical Islamist movements", but it is unclear whether he lived in France at any time after leaving Spain.
German security services, meanwhile, flagged Khazzani when he boarded a flight from Berlin to Istanbul in May this year and in Belgium, Justice Minister Koen Geens confirmed Khazzani was "known" to the country's intelligence services.
France has been on high alert since Islamist gunmen went on the rampage in January, killing 17 people in Paris, and authorities have since thwarted several other attacks.