Armed with an axe and a knife, a 17-year-old Afghan refugee on Monday night attacked passengers on a train in Germany, injuring at least five people.

The Islamic State has now claimed responsibility for the attack and said in a statement that the refugee was a member of the terror group who was responding to their call to go after countries that are part of the anti-ISIS coalition.

"Even during the first emergency call, a witness said that the attacker was shouting 'Allahu akbar' on the train," Joachim Herrmann, Bavaria's interior minister, told ZDF Television. "Also, during the search of his room, a hand-painted IS flag was found." […] The attacker, who was not identified by the authorities, came to Germany two years ago as an unaccompanied minor, and applied for asylum in March of last year. He lived in a home for young refugees until two weeks ago when he was placed with a foster family in the Wuerzburg area. Investigators were talking to the foster family, witnesses and the attacker's friends. The attacker injured at least four people on the train near Wuerzburg-Heidingsfeld on Monday night, and also a woman outside the train as he fled. Witnesses said the interior of the train was covered with blood and looked "like a slaughterhouse," the German news agency dpa reported. About 30 passengers were on the train at the time; more than a dozen were treated for shock.

The attacker was shot and killed by a police special unit.