The Latest on the German train attack (all times local):

4:25 p.m.

German prosecutors say that the 17-year-old Afghan asylum seeker who carried out an ax attack on a train learned over the weekend that a friend had been killed in Afghanistan.

Bamberg prosecutor Erik Ohlenschlager also said that at least two of the wounded were suffering from "acute life-threatening" wounds.

Police fatally shot the attacker as he fled the scene. The Islamic State group claimed the attack, but authorities say the asylum-seeker appears to have been self-radicalized and had no direct link to the extremists.

The teenager shouted "Allahu akbar" ("God is great") as he attacked people on the regional train near the Bavarian city of Wuerzburg Monday night, and a hand-painted IS flag was found during a search of his room, according to state Interior Minister Joachim Herrmann.

___

10:55 a.m.

The Islamic State group has claimed responsibility for an attack on a train in Germany that injured at least five people.

The claim was posted on the group's Aamaq news agency on Tuesday.

It came just hours after a 17-year-old Afghan asylum seeker attacked passengers with an ax and knife on a train near Wuerzburg-Heidingsfeld on Monday night, before he was shot and killed by a special police unit.

The statement says the attacker was "a member of the Islamic State" group and carried out the attack in response to the militant group's calls to attack countries that are members of the anti-IS coalition.

A senior Germany security official said earlier Tuesday that a hand-painted flag of the IS group was found in the attacker's room.

___

8:45 a.m.

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.