A 17-year-old Afghan man who seriously injured four people with an axe on a commuter train in the country's south has been killed by police.

The young man shouted shouted "Allahu akbar" - Arabic for "God is greatest" - before he was shot, two German security officials said.

But they warned that it was not clear whether the attack was an act of terrorism.

The youth went on a rampage on a train between Wurzburg-Heidingsfeld and Ochsenfurt, in southern Germany.