The attacker was a 17-year-old Afghan man, Bavaria's interior minister, Joachim Herrmann, said in an interview on German public television ARD. Herrmann said the police team shot the attacker after he exited the train and charged them.

Police said it is too early to determine a motive or whether the incident might be terrorism related.

The attack on the train comes days after a driver rammed a truck into a crowd in Nice, France, at the end of a Bastille Day fireworks show, killing 84 people. Authorities in France have called that attack an act of terrorism.