german police
© Reuters
A 14-year-old girl has died and another, aged 13, has been seriously injured after they were attacked by a man with a knife while walking to school in southern Germany.

Police say the suspect came out of a refugee shelter in the village of Illerkirchberg on Monday morning and attacked the pupils.

The older girl later died in hospital.

German police arrested a 27-year-old man, who they said was an asylum seeker from Eritrea.

The 13-year-old girl suffered serious knife wounds but reports said her life was not in danger.

The man had fled to the refugee shelter after the stabbing and police said they had found him with a knife thought to have been used in the attack.

The suspect was taken to hospital with serious wounds, thought to have been caused by the knife, and he was later questioned by police.

Prosecutors were trying to establish whether the suspect had psychiatric issues and whether he had known the two girls before the attack.

In a statement, police urged the public not to use the incident to stoke suspicion of foreigners or asylum seekers.

"Everything connected to this is completely unclear so far," police spokesman Wolfgang Jürgens told reporters. However, the far-right AfD were quick to blame Germany's immigration policy for failing to protect primary school children.

Illerkirchberg is a village with a population of less than 5,000 according to the 2015 census.

The 14-year-old girl who died was a German citizen with a family of Turkish origin.

Turkish ambassador Ahmet Basar Sen was expected to visit the village later on Tuesday with the deputy leader of Baden-Württemberg state.

Mayor Markus Häußler said everyone there was in shock, while German Interior Minister Nancy Faeser said the "terrible news" had shaken her.

"I mourn the girl who was killed and sincerely hope that the injured girl will recover... The police are investigating all the backgrounds with intensity," the minister wrote on Twitter (in German).