Islamic State has released a video which claims to show the Afghan asylum seeker who attacked people on a German train making threats in his native Pashto before the attack.
The 17-year-old Afghan asylum-seeker injured five people with an axe and knife, one critically, in the attack in Wuerzburg in Bavaria on Monday evening. He was later shot dead by police after he fled the train.
In the video, the young man holding a knife says he is an “IS soldier” preparing for a suicide mission.
German officials also reported that they later found a hand-painted IS flag in his room.
The teenager reportedly shouted the Islamic phrase “Allahu akbar” (“God is great”) during the attack.
IS’s news agency claimed he had carried out the attack “in answer to the calls to target the countries of the coalition fighting the Islamic State”.
The man has been identified as Muhammad Riyad who entered Germany last summer as part of an influx of around one million refugees from the Middle East.
Watch the chilling video:
Riyad had been in a detention centre before being fostered out with a family in the nearby town of Ochsenfurt.
The attack took place days after a Tunisian delivery man ploughed a truck into crowds of Bastille Day revellers in the southern French city of Nice, killing 84.
Unlike neighbours France and Belgium, Germany has not been the victim of a major attack by Islamic militants in recent years, although security officials say they have thwarted a large number of plots.
A leader of the anti-immigrant Alternative for Germany (AfD) said Merkel and her supporters were to blame for the dangerous security situation because their “welcoming policies had brought too many young, uneducated and radical Muslim men to Germany”.
Police found a hand-painted Islamic State flag in the refugee’s room at his foster family’s home, along with a letter he appeared to have written to his father, which officials said read: “And now pray for me that I can get revenge on these non-believers, pray for me that I go to heaven.”
Islamic State posted a video in which a man whom it identifies as the Afghan refugee vows to carry out a suicide mission and urges other Muslims to do the same.
In the two minute and 20 second video, entitled “Germany — Video of the Islamic State Soldier Muhammad Riyad Who Carried out the Wuerzburg Attack”, a young man wields a small knife, which he says he will use to slaughter infidels and avenge the deaths of men, women and children in Muslim countries.
German officials were checking if the man in the video was in fact the train attacker.
They have not released his name publicly, because he was a minor.
They have said he was not on any of the intelligence services watch lists.
Islamic State claimed responsibility for the attack, according to its Amaq news agency.
But Erik Ohlenschlager, public prosecutor in Bamberg, said there was no evidence the attacker had been in contact with Islamic State, though he said the IS flag the young man appeared to have painted suggested he had developed a sympathy for the group.
Two victims were in a critical condition.