Afghan teen killed in Germany after attacking train passengers with an axe
Emergency responders gather on a road near train tracks in Wuerzburg, southern Germany on July 18, 2016 after a man attacked train passengers with an axe (AFP Photo/Karl-Josef Hildenbrand)

German police shot dead a 17-year-old Afghan on Monday night after he attacked passengers on a train with an axe and a knife, seriously wounding three people, officials said.

Several other people were also injured in the attack on a regional train near the southern city of Wuerzburg, police said, adding that the teenager was killed as he tried to flee.

Joachim Herrmann, the interior minister of Bavaria state, said the attacker was a 17-year-old Afghan who had lived in nearby Ochsenfurt.

The attack happened around 9:15 pm (1915 GMT) on the train, which runs between Treuchlingen and Wuerzburg in Bavaria.

"Shortly after arriving at Wuerzburg, a man attacked passengers with an axe and a knife," a police spokesman said.

"Three people have been seriously injured and several others lightly injured."

He added: "The perpetrator was able to leave the train, police left in pursuit and as part of this pursuit, they shot the attacker and killed him."

There were no further details on the circumstances of the teenager's death, and police declined to suggest what the motive was for the attack.

"At this time everything is possible," the spokesman said.

In May, a mentally-unstable 27-year-old man carried out a similar knife attack on a regional train in the south, killing one person and injuring three others.

Early reports suggested he had yelled "Allahu akbar" ("God is greatest" in Arabic) but police later said there was no evidence pointing to a religious motive. He is being held in a psychiatric hospital.