“He was known as an Islamist but not a jihadist,” police spokesman Andy Grote said, noting that the suspect also suffered from “psychological” issues.
The man, a failed asylum seeker born in the United Arab Emirates, attacked customers at random on Friday.
Police said he acted alone and he was overpowered by passers-by.
The 26-year-old man was also suffering from mental health problems, officials said at a press conference on Saturday.
It is not yet clear what the suspect’s motivations were.
ALSO READ: Hamburg supermarket attack leaves one dead
The attack happened in the Barmbek region in the north of the city in a branch of Edeka, Germany’s largest supermarket chain.
Police praised the courage of the three men who followed the attacker after video footage emerged of passers-by using chairs as shields to corner the suspect.
Eyewitnesses said that members of the public shouted at the man in Arabic to drop the knife.
One eyewitness suggested on German TV that the knife used in the attack was about 50cm (20 in) long.
A 50-year-old woman and four men aged between 19 and 64 were stabbed, while a 35-year-old man was injured while helping overcome the suspect.