German police have shot and killed an Aghan teenager who attacked passengers on a train with an axe and a knife, in an incident which is likely to worsen the divide in public opinion in the country over the refugee crisis.

Witnesses described a train carriage that was left "like a battlefield" covered in blood after the unnamed 17-year-old injured four people, believed to be members of the same family originating from Hong Kong.

Police in Würzburg, Bavaria 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.

And Bavaria's most senior security official, state interior minister Joachim Hermann, told ARD TV the attacker was understood to have travelled to Germany as an unaccompanied refugee minor.

Marcel Dirsus, a political analyst at Kiel University, told the BBC's Radio 4 that the incident was "bound to exacerbate anger" over the country's open door refugee policy.

In pictures: German train axe attack Show all 8 1 /8 In pictures: German train axe attack In pictures: German train axe attack Blood stains are seen on the regional train on which a man allegedly wielding an axe attacked passengers in Wuerzburg EPA In pictures: German train axe attack A patch of blood and the remains of bandaging material lie on a sidewalk near Wuerzburg EPA In pictures: German train axe attack The body of a 17-years-old attacker is carried to a hearse in Wuerzburg AP In pictures: German train axe attack Police officers search for evidence near Wuerzburg EPA In pictures: German train axe attack Police stand by the regional train on which a man wielding an axe attacked passengers in Wuerzburg EPA In pictures: German train axe attack Firefighters stand at a road block in Wuerzburg EPA In pictures: German train axe attack Rescuers gather on a road near railtracks in Wuerzburg after a man attacked train passengers with an axe AFP/Getty Images In pictures: German train axe attack German emergency services work in the area where a man with an axe attacked passengers on a train Reuters

He said: "This is a tragedy, but it is really a tragedy beyond the people who are directly affected, because this is a very contentious issue in Germany, the way we are dealing with refugees.

"And in a society that is already polarised over the issue, this is bound to exacerbate anger and division."

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.

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 fifth family member, a 17-year-old son, was not hurt. The paper did not cite its source.

The department said it is working to provide assistance to the family but did give not give details of their injuries. Hong Kong's top official, Chief Executive Leung Chun-Ying, condemned the attack and extended his sympathies to the victims.

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 arrived in the country earlier.

Mr Herrmann said initial information was that the suspect 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.

German emergency services work in the area where a man with an axe attacked passengers on a train (Reuters)

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.

Eyewitness Thomas Velten, who went to see what had happened after the train stopped, told the Post the carriage was "like a battlefield" with a large amount of blood.