The Islamic State group said on Tuesday that an Afghan refugee who carried out an axe and knife attack in Germany 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.
The attack on a train near the southern city of Wuerzberg appeared to be the first time IS has claimed an attack in Germany.
The attacker was a 17-year-old Afghan refugee, who had arrived as an unaccompanied minor in Germany and was staying with a foster family in the region.
His rampage seriously wounded four members of a family from Hong Kong, two of whom were in critical condition.
The assailant was killed as he tried to flee, authorities in Germany said.
IS has claimed multiple attacks carried out in its name via Amaq or its official media outlets, regardless of whether the perpetrators have any direct links with the group.
The group has regularly urged followers to target "disbelievers," with its spokesman Abu Mohamed al-Adnani in September 2014 calling on supporters to use stones, knives or vehicles as weapons.
German authorities said earlier Tuesday that a hand-painted flag of the IS group had been found among the assailant's belongings.
"It is quite probable that this was an Islamist attack," said a ministry spokesman, adding that the assailant had shouted "Allahu akbar" (God is greatest).