THE Islamic State has claimed responsibility for a knife and axe attack on a German train as the group releases what it says is a video of the culprit.

Though the Islamic State group claimed responsibility through its Aamaq news agency, Bavaria’s Interior Minister Joachim Herrmann said the suspect, whose identity has not been released, had written notes in his native Pashto that indicated he may have been self-radicalized and there was “no indication” he was directly connected to the IS group.

IS’s Aamaq released a video that purported to show the attacker, in which a young man waves a knife toward the camera and says “I will slaughter you with this knife and will behead you with axes.”

Aamaq identified the teen as Muhammad Riyad but police have not confirmed his identity yet.

In the video, the authenticity of which it was not immediately possible to verify, the man also says he is “one of the soldiers of the Islamic State and will carry out a martyrdom operation in Germany,” according to the Arabic-language subtitles.

The teenage Afghan asylum seeker shouted “Allahu akbar” (“God is great”) during the axe and knife attack on a train in southern Germany that injured at least five people.

Mr Herrmann said on public television that investigators raiding his room also found a handpainted flag of the Islamic State group.

The attacker was shot and killed by a special police unit which coincidentally happened to be nearby.

“Even during the first emergency call, a witness said that the attacker was shouting ‘Allahu akbar’ on the train,” Herrmann told ZDF Television.

“Also, during the search of his room, a handpainted 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.

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

German officials did not identify the victims, but Hong Kong’s immigration department said on Tuesday that among those injured in the attack were four members of a family of five from the southern Chinese city who died.

The attacker, a German citizen, also shouted “Allahu akbar” during the attack, but authorities found no evidence of links to Islamic extremists. The attacker was later sent to a psychiatric hospital.

CHILLING PHOTOS OF TRAIN CARRIAGE

The train carriage where a teenager went on a brutal, axe-wielding stabbing spree in Germany looked “like a slaughterhouse” after the attack, a witness said.

The witness, who declined to give his name, said he saw passengers crawl from the carriage and ask for a first-aid kit as other victims lay on the floor inside, DPA news agency reports.

A chilling photo taken of the train carriage show it splattered with blood and strewn with blood-soaked towels.

Wuerzburg police said on their Facebook page that three of the victims suffered “serious injuries” and one other has non life-threatening injuries, while at least another 14 passengers are being treated for minor injuries and shock.

Local broadcaster ARD reports the teen was shot dead by police as he was “fleeing the scene”.

Herrmann said he had arrived as an unaccompanied minor in Germany and was living nearby Ochsenfurt.

The teen was armed with an axe and knife when he stabbed passengers on the train near Wuerzburg in Bavaria, in the country’s south.

Suspect in #Wuerzburg train attack was a 17-year-old Afghan man, Bavarian interior minister Herrmann says on German public television — Carlo Angerer (@carloangerer) July 18, 2016

17-year-old Afghan boy who came to Germany as unaccompanied refugee attacks train passengers with an axe. Details still emerging — Rohit Kachroo (@RohitKachrooITV) July 18, 2016

HOW THE ATTACK UNFOLDED

The train was on its way from the Bavarian town of Treuchtlingen to Wuerzburg, which is about 100 kilometres northwest of Nuremberg. The rail line between Wrzburg-Heidingsfeld and Ochsenfurt has been closed, the police spokesman said.

There was no indication of the motive for the attack.

The passengers are said to be in a state of disbelief after the teenager used “blunt” and “slashing” weapons, according to The Independent.

Herrmann, the interior minister of Bavaria state, confirmed the attacker was a 17-year-old Afghan who had lived in nearby Ochsenfurt.

Man attacks passengers with an axe on a train in Germany https://t.co/eustzBf9Hn pic.twitter.com/Eq60bbRWLX — SOFREP (@SOFREP) July 18, 2016

The attack happened around 9:15pm on board the train, which runs between Treuchlingen and Wuerzburg in Bavaria.

“Shortly after arriving at Wuerzburg, a man attacked passengers with an axe and a knife,” a police spokesman said.

“Three people have been seriously injured and several others lightly injured.”

He added: “The perpetrator was able to leave the train, police left in pursuit and as part of this pursuit, they shot the attacker and killed him.”

There were no further details on the circumstances of the teenager’s death, and police declined to suggest what the motive was for the attack.

“At this time everything is possible,” the spokesman said.

Local reports say up to 21 passengers were injured during the rampage, according to the BBC.

Attacker on regional train near Würzburg, Germany, was shot and killed by police as he fled the scene, officials confirm to @NBCNews — Carlo Angerer (@carloangerer) July 18, 2016

The attack came days after terrorist Mohamed Lahouaiej Bouhlel killed 84 people in Nice, France, after he drove a truck into crowds on a beachfront promenade during the Bastille Day fireworks.

In May, a mentally-unstable 27-year-old man carried out a similar knife attack on a regional train in Germany, killing one person and injuring three others.

Early reports suggested he had yelled “Allahu akbar” (meaning “God is greatest” in Arabic) but police later said there was no evidence pointing to a religious motive.

He is being held in a psychiatric hospital.

POLITICAL TENSIONS IN GERMANY OVER ASYLUM SEEKER DEBATE

There are fears the axe attack in Bavaria could revive political tensions in Germany.

Germany let in a record nearly 1.1 million asylum seekers last year, with Syrians the largest group followed by Afghans fleeing ongoing turmoil and poverty in their country.

The number of refugees arriving in Germany has fallen sharply as a result of the closure of the Balkans migration route and an EU deal with Turkey to stem the flow.

In April, May and June, the number was around 16,000 each month, less than a fifth of the tally seen at the start of the year, according to official figures.

Bavaria is governed by the Christian Social Union (CSU), sister party to Chancellor Angela Merkel’s conservative Christian Democrats.

The CSU has been loudly critical of Merkel’s welcoming stance toward asylum seekers, a split that threatened the unity of the ruling coalition in Berlin and sent the government’s approval ratings plunging.

It has also lent support to a right-wing populist party, Alternative for Germany, which was founded as a Eurosceptic protest party in 2013 but now mainly rails against Islam and Germany’s refugee influx.

It currently polls at more than 10 per cent and is represented in half of Germany’s 16 states as well as the European Parliament.