We now know who was behind the bloody and violent German train attack

A police officer walks to the crime scene where a 17-year-old man from Afghanistan was shot the night before, in Wuerzburg, Germany, Tuesday, July 19, 2016. On Monday evening, the man wielding an axe and knife attacked travelers on a regional train near Wuerzburg. Four people were seriously injured. He was shot and killed by police as he fled. (AP Photo/Michael Probst)

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

Videos by Rare

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

It came 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 which happened to be nearby.

“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.”

RELATED: Radical Islam is a threat to our way of life—so is blaming all Muslims

Herrmann said that it was too early to draw conclusions about the attacker’s motive.

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 jumped off the train after someone pulled the emergency cord and got about 500 meters (yards) away before the police special unit chased him. As police drew near, the assailant started attacking the officers and was shot, dpa reported, quoting Herrmann.

On Tuesday morning, officers could be seen removing the attacker’s body from the scene.

Herrmann said at least two victims — members of a Chinese tourist family — were in critical condition.

RELATED: The latest footage of an explosion on ISIS militants attempting to run is massive

German officials did not identify the victims, but Hong Kong’s immigration department said Tuesday that among those injured in the attack were four members of a family of five from the southern Chinese city. The department said it is working to provide assistance to the family but gave no details of their injuries.

Dpa reported that the attacker injured the 62-year-old father, the 58-year-old mother, their adult daughter and her boyfriend. The teenage son was not injured. The father and the boyfriend had tried to defend the other family members, dpa said.

Germany last year registered more than 1 million asylum seekers entering the country, including more than 150,000 Afghans.

In May, a man stabbed four people at a German train station in a random early-morning attack in Grafing near Munich. One man later died. The attacker, a German citizen, also shouted “Allahu akbar” during the attack, but authorities found no evidence of links to Islamic extremists. He was later sent to a psychiatric hospital.

What do you think?

Republican Senator Mike Lee suggests Donald Trump could kill the Republican Party

Egg rolls, unwrapped — next time, make your Asian food in the style of a Chipotle burrito bowl