A teenage Afghan refugee armed with an axe and knife injured four people on a train in southern Germany before being shot dead by police, officials say.
Three people were seriously hurt and one suffered minor injuries in the attack in Wurzburg, police said.
Initial reports said up to 20 people had been injured but it was later revealed that at least 14 had been treated for shock.
The motive for the attack is not yet clear.
Bavarian Interior Minister Joachim Herrmann said the attacker was a 17-year-old Afghan refugee who had been living in the nearby town of Ochsenfurt.
He told public broadcaster ARD that the teenager appeared to have travelled to Germany as an unaccompanied minor.
Mr Herrmann said authorities were looking into reports that the attacker had yelled out “an exclamation”. Some witnesses quoted by German media said they had heard him shout “Allahu akbar” (“God Is Great”) during the attack.
The incident happened at about 21:15 (19:15 GMT) on the train which runs between Treuchlingen and Wurzburg.
“Shortly after arriving at Wurzburg, a man attacked passengers with an axe and a knife,” a police spokesman said.
Police said the attacker had fled the train but was chased by officers who shot him dead.
Although the motive has not been established, the BBC’s Damien McGuinness in Berlin says there is nervousness in Germany about attacks by Islamist extremists following the attacks across the border in France.
In May, a man reportedly shouting “Allahu akbar” killed one person and wounded three others in a knife attack at a railway station near the German city of Munich.
He was later sent to a psychiatric hospital and authorities said they found no links to Islamic extremism.