Get the stories that matter to you sent straight to your inbox with our daily newsletter. Subscribe Thank you for subscribing We have more newsletters Show me See our privacy notice Invalid Email

A TEENAGE Afghan migrant armed with an axe and a knife who attacked passengers on a train in southern Germany had an Islamic State flag in his bedroom, according to officials.

The attacker injured five people before he was shot and killed by police as he fled.

Wuerzburg police said on their Facebook page that three of the victims suffered serious injuries and one was slightly injured. Another 14 people were being treated for shock.

Bavaria's most senior security official, state interior minister Joachim Herrmann, told Germany's ARD television that the attacker had been identified as a 17-year-old Afghan.

The attacker shouted "Allahu akbar" ("God is great") during the attack, a top official has said.

Bavaria's interior minister Joachim Herrmann said that investigators raiding the teenager's room also found a hand-painted flag of the self-styled Islamic State group.

Watch: Emergency vehicles and personnel swarm the crime scene.

Video Loading Video Unavailable Click to play Tap to play The video will start in 8 Cancel Play now

Video Loading Video Unavailable Click to play Tap to play The video will start in 8 Cancel Play now

Watch: German minister says Pashto text found in train attacker's room.

Germany last year registered over a million migrants entering the country, including more than 150,000 Afghans, but it was not immediately clear whether the suspect was among them or someone who had been in the country for a longer time.

Mr Herrmann said initial information was that the suspect came to Germany as an unaccompanied minor and had lived in the Wuerzburg area for some time, initially at a refugee facility in the town of Ochsenfurt and more recently with a foster family.

He said authorities were still investigating the motive of the attack and were looking into reports that the suspect had yelled out "an exclamation" during the rampage.

He was responding to reports that some witnesses had heard the suspect shout "Allahu Akbar" ("God Is Great") during the attack.

The regional train was on its way from the Bavarian town of Treuchtlingen to Wuerzburg, which is about 60 miles north-west of Nuremberg.

German officials did not identify the victims, but Hong Kong's immigration department said that among those injured in the attack were four members of a family of five from the territory.

(Image: REUTERS/Kai Pfaffenbach)

The department said it is working to provide assistance to the family but did give not give details of their injuries.

The South China Morning Post newspaper reported that the family members hurt included the 62-year-old father, 58-year-old mother, 27-year-old daughter and her 31-year-old boyfriend. A 17-year-old son was not hurt.

Hong Kong's most senior official, chief executive Leung Chun-Ying, condemned the attack and extended his sympathies to the victims and their families.

He said representatives from Hong Kong's office in Berlin were visiting the injured residents.

32