Train tracks are pictured on July 19, 2016, near Wuerzburg, Germany, a day after a young man attacked train passengers with an axe (Photo: AFP)
A 17-year-old migrant wielding an axe and a knife went on a rampage on a German train, seriously injuring four members of a tourist family from Hong Kong and a passer-by.
German authorities have cast doubt on whether he was a refugee from Afghanistan as originally thought, saying Wednesday he might have been from Pakistan.
Here is what we know about Monday's attack that the Islamic State group claims was carried out by one of its "fighters". The group has also released video footage of the attacker making threats.
It happened around 9:15 pm (1915 GMT) on the train carrying around 25 people running between the town of Treuchtlingen and Wuerzburg in Bavaria, southern Germany.
Media reports identified the attacker as Riaz A. He boarded the train and soon after went to the onboard toilet, emerging moments later with the axe and knife drawn.
Shortly before the train pulled into Wuerzburg, the teenager began shouting "Allahu akbar" (God is greatest) and slashing passengers, gravely injuring the four tourists. One of them is in critical condition.
A passenger pulled the train's emergency break and the assailant ran to evade special police forces, who were deployed nearby by chance.
He attacked a woman walking her dog along the river while trying to evade police. Prosecutors said he shouted "I'll get you, you bitch" as he brought the axe down on the head of the victim, who is also now fighting for her life.
When he began to attack officers with the axe, the teenager was shot dead by police.
Witnesses said the carriage looked "like a slaughterhouse", with victims' blood covering the floor.
Authorities said he arrived in Germany as an unaccompanied minor in June 2015 and was registered in the border city of Passau, a major hub of last year's record refugee influx.
He was placed in a shelter in the Wuerzburg region in March before being settled with a foster family.
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 of securing asylum, television station ZDF reported.
Locals described him as "calm and even-keeled" and a "devout Muslim" who "did not appear to be radical or a fanatic".
However investigators found a hand-painted Islamic State group flag in his room as well as a letter, believed to be a farewell message to his father, in which he discussed the situation of the world's Muslims, saying they "must defend themselves".
Riaz A. had worked as an apprentice in a bakery and had a good chance of getting a long-term training position common in German trades, Bavarian social affairs minister Emilia Mueller told DPA news agency.
Soon after German authorities said they found the IS flag among Riaz A.'s belongings, the Islamic State group claimed responsibility for the attack and said he was one of its "fighters," an IS-linked news agency said.
"The perpetrator of the stabbing attack in Germany was one of the fighters of the Islamic State," the Amaq news agency said, citing a "security source".
"He carried out this operation responding to calls to target countries of the coalition fighting IS," it added, referring to the US-led coalition targeting the jihadist group in Syria and Iraq.
Islamic State later released video footage of the attacker but authorities said they were still trying to determine its authenticity.
The rampage appeared to be the first time IS has claimed an attack in Germany.
While the attack has the potential to revive a heated national debate on the integration of migrants and refugees, regional authorities were quick to call for calm.
"It is undisputed that he was a refugee and if he hadn't been there he wouldn't have committed this act," Herrmann said.
"But I don't think that we should make blanket judgements in any way about refugees."
Herrmann said there was no indication that Chinese citizens were intentionally targeted in the attack.
Federal justice minister Heiko Maas tweeted that the assault must "carefully investigated" and said "radicalism must be fought in all its forms".