An Afghan refugee attacked passengers with an axe on a train in southern Germany, a senior state official said on Tuesday.
The 17-year-old severely wounded four passengers before police shot him dead late on Monday, days after a Tunisian delivery man plowed a 19-tonne truck into crowds of revelers in the southern French city of Nice, killing 84.
The case is likely to deepen worries about so-called "lone wolf" attacks in Europe and could put political pressure on German Chancellor Angela Merkel, who welcomed hundreds of thousands of migrants to Germany over the past year.
Bavarian state Interior Minister Joachim Herrmann said it was still too early to say whether the Afghan youth was a member of Islamic State, which has claimed responsibility for the French attack, or any other militant group, but a hand-drawn Islamic State flag was found in the room of the attacker.
Two of those injured in the attacks were in a critical condition and several of the injured included members of a Chinese family, he added, without giving any further details.
At least one witness reported that the attacker, who had been living with a foster family in the nearby town of Ochsenfurt, had shouted "Allahu Akbar" (God is greatest), Herrmann told ZDF television.
"All of that has to be put together in a large mosaic as to what his motivations were, and to what extent he can be counted as an Islamist, or to what extent he radicalized himself in recent times," Herrmann said. "We are pursuing every piece of evidence."
Herrmann told the Bayerischer Rundfunk radio station in a separate interview that the attacker had come to Germany as an unaccompanied minor about two years ago.
He started attacking his passengers with an axe and a knife as the train was approaching its last stop, the Bavarian city of Wuerzburg.
He fled after the emergency brake was pulled and was pursued by a police unit and shot dead when he tried to attack the officers, officials said.
The South China Morning Post said the injured passengers were from Hong Kong.
Unlike neighbors 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.
Germany welcomed roughly 1 million migrants in 2015, including thousands of unaccompanied minors. Many were fleeing war in Syria, Iraq and Afghanistan.