German police say a hand-drawn Islamic State (IS) flag was found in the room of the 17-year-old Afghan asylum seeker who attacked passengers on a train in Bavaria, in southern Germany, before being shot dead by police on July 19.
The IS-linked news agency Amaq said the attack was carried out by an IS “fighter.”
The claim comes as the interior Minister for the state of Bavaria, Joachim Herrmann, said it was too early to speculate whether the attacker was a member of an Islamist group or had become self-radicalized in recent times.
Police say the teenager shouted "Allahu akbar!" ("God is great!") as he attacked the passengers with an ax and knife, injuring five people, two of them critically.
Authorities say a family from Hong Kong is among the injured.
Police said there was not yet any information on the motive behind the attack. They said the teen had arrived in Germany without his parents two years ago, had lived in a refugee home in Ochsenfurt in the Wuerzburg area, and more recently was with a foster family.
The Bavarian Interior Ministry said police shot and killed the attacker as he fled the train.
The train was on its way from the Bavarian town of Treuchtlingen to Wuerzburg, which is about 100 kilometers northwest of Nuremberg.
Police said the rail line between Wuerzburg-Heidingsfeld and Ochsenfurt was closed because of the incident.