Updated

A German top official says a 17-year-old Afghan asylum seeker shouted "Allahu akbar" ("God is great") during an ax and knife attack on a train in southern Germany that injured five people.

Bavaria's interior minister Joachim Herrmann said Tuesday on public television that investigators raiding his room also found a hand-painted flag of the Islamic State group.

Herrmann told ZDF Television the attacker came to Germany two years ago as an unaccompanied minor, and applied for asylum in March. He lived in a home for teenage refugees until two weeks ago when he was placed with a foster family. He was shot and killed by police as he fled from the scene.

Herrmann said two victims — members of a Chinese tourist family — are in critical condition.