A man shouting "Allahu Akbar" stabbed to death one person and wounded six others in a supermarket in the German city of Hamburg on Friday.

The attacker, who was born in the United Arab Emirates, was overpowered by passers-by and arrested.

Olaf Scholz, the mayor of Hamburg, said the attack had been motivated by "hate" and added that the suspected attacker was a failed asylum seeker whose deportation had been blocked because he lacked identity papers.

View more!

"I am outraged by the vicious attack that killed at least one Hamburger today," he said.

"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."

Citing security sources, Berlin newspaper Der Tagesspiegel reported that the 26-year-old perpetrator was known to police as an Islamist. News agency DPA reported that security authorities were investigating evidence the man had Salafist ties.

The attacker stabbed to death a 50-year-old man believed to be a German citizen

Police said that he "struck out wildly" at others, wounding five more in the supermarket - a 50-year-old woman and four men aged 19, 56, 57 and 64.

Another 35-year-old man was hurt while overpowering the attacker in the street alongside other passers-by shortly after the killing.

All of the wounded were being treated or operated on in hospital, some of them for serious injuries, police said.

Police officers secure the area after a knife attack at a supermarket in Hamburg credit: Paul Weidenbaum/AP

A police murder unit and a specialist politically-motivated crime squad are investigating the attack and were able to secure the suspected murder weapon.

German daily Bild published a picture of the attacker in the back of a police car with a white, blood-soaked bag over his head, and reported that he cried "Allahu Akbar" (God is Greatest) during the attack.

"Suddenly I saw a man smeared with blood running along the other side of the road with a knife," an eyewitness identified as Ralf W. told Bild. "He shouted out 'Allahu Akbar' as he was running."

A female witness standing in line at the supermarket till also told NTV rolling news channel that "as he was running out... he held up his arms and shouted 'Allahu Akbar'."

"I thought I was in a horror movie, I thought he would kill me," an unnamed woman who had been in the supermarket told rolling news channel NTV.

She said she feared she would die, as she was "queueing for the till and couldn't get away".

Police investigators work at the crime scene after a knife attack in a supermarket in Hamburg credit: Morris Mac Matzen/Reuters

The suspect fled the supermarket after the attack.

But "people were running after him with improvised weapons, chairs and sticks... they ran after him into a side street," Ralf W. told Bild.

"People chased after the killer with chairs, they were throwing them at him," bakery worker Shaylin Roettmer told DPA.

The witnesses slightly injured the attacker while they were overpowering him, before handing him over to police.

Police cars outside the supermarket in Hamburg credit: @MarcoZitzow

Police blocked off the lively and diverse high street dotted with cafes and shops in the northeast of the port city, Germany's second largest and host of the G20 summit of world leaders in early July.

Anti-terror officers armed with automatic weapons patrolled the scene and onlookers gathered behind strips of red-and-white police tape.

While the attacker's motives remain unknown, Germany has been on high alert about the threat of a jihadist attack, especially since last December's truck rampage through a Berlin Christmas market that killed 12 people.

The Islamic State group claimed responsibility for the carnage in which a Tunisian rejected asylum seeker and ex-convict, Anis Amri, 24, ploughed the stolen truck through a crowd.