Residents tearfully embraced each other and laid flowers Thursday in the German city of Hanau after a gunman with suspected far-right beliefs killed nine people at a shisha bar and a cafe.

"You never think about something like this happening near to you," 27-year-old Baran Celik told AFP outside the Midnight shisha bar, where the first of the two shootings took place.

"You see things like this on the news... and then it happens right in front of your door -- it's tragic."

Twenty-year-old Sabuhr Alizadeh said the attacks were "horrific".

"Someone I know was here when the shooting started, he called me and hid under a table," said Alizadeh, an Afghan who has lived in Hanau for nearly four years.

As prosecutors confirmed that the Hanau suspect, Tobias R., had harboured a "deeply racist attitude", Alizadeh told AFP that the racists "should just go away".

"It's deeply sad because Hanau is known for having people from different countries and religions... we will hold together in future because this is our home," he said.

Just a few minutes' walk from Hanau's central market square, the shisha bar was the first of two locations targeted in the rampage.

At the second, the Arena Bar & Cafe, police hurried to cover up the address of the perpetrator's website with a blue plastic sheet after it was spray-painted on a nearby wall.

It was on this website that shooter Tobias R. published a rambling, 24-page 'manifesto' detailing racist and paranoid conspiracy theories.

For Hanau resident Inge Bank, it was a "disgrace that something like this can still happen today".

German President Frank-Walter Steinmeier  led a vigil alongside the mayor of Hanau Claus Kaminsky later Thursday, one of more than 50 such events planned across Germany
German President Frank-Walter Steinmeier led a vigil alongside the mayor of Hanau Claus Kaminsky later Thursday, one of more than 50 such events planned across Germany AFP / Odd ANDERSEN

The 82-year-old Hanau resident said she had lived through World War II and seen her mother imprisoned in a concentration camp.

Near the Arena bar, Ahmed, 30, said it was "unbelievable" that someone with racist views could have lived in Hanau.

"This is a completely normal bar, I used to buy my cigarettes here!"

German President Frank-Walter Steinmeier and Interior Minister Horst Seehofer both laid wreaths at the crime scene, as residents lingered, crying and sometimes linking arms.

Steinmeier led a vigil alongside the mayor of Hanau Claus Kaminsky on Thursday evening -- one of more than 50 such events across Germany -- calling on Germans to show "consideration and solidarity" in the face of hatred.

Yet 49-year-old Hatice Nazerzadeh, who travelled to Hanau from Hamburg after her cousin Gokan Gultekin was killed in the attacks, said that words alone "didn't help".

"A part of us is gone, and it cannot be replaced by nice words," she said.

The heart of the matter, she said, was the far-right AfD party, which has surged in the polls since it was founded seven years ago.

"Racism is the same as the AfD. Nazis are the same as the AfD. And when the AfD is legal in Germany, then racism and Nazis are legal in Germany."

"You can't then just say that we don't want racism, it's contradictory. Something has to change."

The Hanau attacks came amid growing concern over a rise in right-wing extremism in Germany.

In the last year, far-right suspects have been arrested over an attack on a synagogue in the eastern city of Halle and the murder of politician Walter Luebcke, an advocate of a liberal refugee policy.