A failed asylum seeker born in the UAE launched a knife attack on shoppers in a supermarket in Hamburg, Germany, killing one person and injuring six.
Police said the man was 26 years old but did not confirm his name or his nationality.
Witnesses said the attacker shouted "Allahu akbar" before being apprehended by passers-by while trying to flee the scene on Friday.
Hamburg mayor Olaf Scholz said the attack had been motivated by "hate" but did not call it a terrorist incident.
"It makes me especially angry that the perpetrator appears to be a person who claimed protection in Germany and then turned his hate against us," he said.
Mr Scholz said the attacker had been due to be deported but that his expulsion had been delayed because he did not have identity papers.
German news website Spiegel Online has named the man as Ahmad A, reporting that he had contact with the Islamist scene in Hamburg.
An eyewitness filmed emergency services arriving at the scene, sharing the footage on social media.
Last December, Tunisian Anis Amri killed 12 people and injured 48 after he drove a truck into crowds at a Berlin Christmas market.
A news conference led by police and the city-state's interior minister was expected to offer further details about Friday's incident later on Saturday.
The attack, which comes less than two months before Germans go to the polls to elect members to the 19th Bundestag, is likely to reignite the debate on German chancellor Angela Merkel's decision to allow more than one million asylum seekers into the country in 2015.
Beatrix von Storch of Alternative for Germany, an Islamophobic populist party which is expected to enter the parliament for the first time in September, used the attack to criticise Mrs Merkel's immigration policy.
"Before Mrs Merkel tweets again that this is 'beyond comprehension': this has something to do with Islam. Comprehend that once and for all!", she posted on Twitter.