One man was killed and three others wounded by a man wielding a knife east of Munich and police are investigating a possible Islamist connection.
The man attacked passers-by shortly before 05:00 (03:00 GMT) on Tuesday at Grafing station. One of those hurt was in a serious condition.
The attacker was eventually overpowered by police. A man has been arrested.
Some witnesses said he shouted “Allahu akbar” (“God is great” in Arabic) but the motive for the attack is unclear.
Bavarian public radio reports that the Munich prosecutor has imposed a news blackout and that contradictory statements have emerged from the scene.
An Upper Bavaria police spokesperson said that a “political motive” had certainly not been ruled out.
The mayor of Grafing, Angelika Obermayr, told Sueddeutsche Zeitung that the suspect was a German national.
“The idea that people get on an S-Bahn train on a beautiful morning or do their paper round and then become victims of a maniac is terrible,” she was quoted as saying.
One of the platforms at Grafing station has been cordoned off and commuter trains have been hit by delays.