WUERZBURG: German authorities have cast doubt on whether a teenager who went on an axe rampage on a Bavarian train was really an Afghan refugee, saying Wednesday he might have been from Pakistan.

The militant Islamic State (IS) group released a video on Tuesday purportedly featuring the 17-year-old, who was shot dead by police following the train attack in which he injured five people, two of them critically.

However, sources close to the German security services now think he might have pretended to be Afghan on arrival in Germany in 2015 in order to have a better chance at securing asylum, television station ZDF reported.

In the IS video the youth uses phrases of a dialect of Pashto spoken in Pakistan and not Afghanistan and experts have indicated that his accent is also clearly Pakistani, ZDF said.

A Pakistani document was also found in his room.

The name he used in the video, “Mohammed Riyadh”, does not match the name under which he registered in Germany, Riaz Kahn, the station added.

German authorities said they had authenticated the video.

On Tuesday, authorities said they had found a hand-painted IS flag and what they called a suicide letter among the attacker's belongings.

“The perpetrator of the stabbing attack in Germany was one of the fighters of the Islamic State,” the IS-linked Amaq news agency said.

'Calm and even-keeled'

Locals described the assailant, identified in media reports as Riaz A., as “calm and even-keeled” and a “devout Muslim who did not appear to be radical or a fanatic”, according to Joachim Herrmann, interior minister of Bavaria state.

“According to the investigation thus far, there was no evidence on site to point to him belonging to the Islamist network,” Herrmann said.

Police however later found a farewell letter he apparently left for his father in which he said the world's Muslims “must defend themselves”.

“Now pray for me that I can take revenge on non-believers, pray for me that I can get to heaven,” the note said.

Prosecutors said he shouted “Allahu Akbar” (God is greatest) three times as he made his way through the carriage.

An eyewitness told DPA news agency that the train, which had been carrying around 25 people, looked “like a slaughterhouse”.

Germany has thus far escaped the kind of large-scale jihadist attack seen in the southern French city of Nice last week, in which 31-year-old Mohamed Lahouaiej Bouhlel used a truck to mow down 84 people.

That attack was also claimed by IS without the assailant having clear ties to the group.

A record 1.1 million people were let in to Germany last year, with Syrians making up the largest group followed by Afghans.

The assailant had arrived as an unaccompanied minor in Germany in June 2015 and had been staying with a foster family in the region for the last two weeks, Herrmann said.

“We must determine what the motive was and to what extent he really belonged to the Islamist scene or self-radicalised very recently,” Herrmann said, adding that the assailant had no criminal record in Germany.

Hong Kongers badly injured

Four members of a family of tourists from Hong Kong were injured in the attack, with two of them in intensive care, and a passer-by was also hurt.

The elder daughter of the Yau family told local media that her parents tried to defend her sister's boyfriend when the axe-wielding teenager went for him.

“Originally the assailant was attacking my sister's boyfriend and when my mother and father saw, they went up to get in the way and then they got injured,” Sylvia, 30, told the Hong Kong-based Apple Daily newspaper Tuesday night.

Her father and sister's boyfriend are now in intensive care with serious head injuries. Her sister Tracy, 26, and mother, 58, were also injured, while Sylvia's 17-year-old brother was unharmed.

“My father-in-law's friends received pictures and said they were having lots of fun,” said Sylvia's husband, who was not named.

Political tensions

In May, a mentally unstable 27-year-old man wielding a knife killed one person and injured three others on another Bavarian regional train.

Early reports had suggested he had yelled “Allahu Akbar” but police later said there was no evidence pointing to a political motive. He is being held in a psychiatric hospital.

In February, a 15-year-old girl of Turkish origin stabbed a policeman in the neck with a kitchen knife at Hanover train station in what prosecutors later said was an IS-inspired attack.

Before ZDF reported on the questions over the attacker's nationality, Bavarian interior minister Herrmann had warned against demonising asylum seekers.

"It is undisputed that he was a refugee and if he hadn't been there, he wouldn't have committed this act. But I don't think that we should make blanket judgements in any way about refugees."