The announcement comes hours after a 17-year-old Afghan refugee attacked passengers with an axe and a knife. He was shot and killed during an altercation with police after fleeing the scene, a Bavarian police spokesman told ABC News.
The three injured are in serious condition, one is less serious, and 14 others were being treated for shock, according to the spokesman.
Police said the incident occurred on a local train heading towards Würzburg at Heidingsfeld, in Bavaria.
Joachim Hermann, the interior minister of Bavaria, said investigators found a hand-painted flag of the Islamic State group in the attacker's room.
Hermann told a German TV Station that he didn't rule out the possibility that one of the victims could die in the attack. He said that a special police unit was rerouted to the scene and apprehended the attacker in Heidingsfeld.
"Completely by chance there was a special police unit working in Würzburg which immediately rerouted," Hermann said. "They apprehended the attacker in Heidingsfeld. There, presumably, the attacker then turned on police with his knife or axe and so the police officers opened fire and shot the attacker."
This is a breaking story. Please check back for updates.