A failed asylum seeker has been sentenced to life imprisonment for a knife attack at a Hamburg supermarket last July.

The Palestinian attacker, Ahmad Alhaw, killed a 50-year-old man and seriously wounded six other people.

Alhaw shouted Islamist slogans as he lashed out. He was pursued and held down in the street by men from the German-Turkish community.

Alhaw pledged allegiance to the Islamic State group.

But as there was no evidence that IS had helped him plot the attack, he was not charged with terrorism.

The judge highlighted the particular severity of the attack, making it unlikely that Alhaw will qualify for early release after the standard 15 years.

Since 2015, more than a million migrants and refugees, many of whom had fled war and abuses in Afghanistan, Iraq and Syria, have entered Germany as a result of Germany's liberal migration policy.

The Hamburg attack was the second significant Islamist attack in less than a year.

In December 2016, a Tunisian failed asylum seeker killed 12 people by driving a truck into a Christmas market in Berlin.

The migration situation has caused significant debate in Germany, with both main political groupings perceived as being hurt by their migration policies in the September 2017 general election.

Some have suggested migrants should be paid to leave the country.

Hamburg's Interior Minister Andy Grote said after the attack that the attacker could not be deported as he lacked identification documents and was psychologically unstable.