A German man has shot and killed nine people at several locations in a Frankfurt suburb in attacks that appear to have been motivated by far-right beliefs, officials said.

The gunman first attacked a hookah bar in central Hanau at about 10pm on Wednesday, killing several people, before heading about 1.5 miles west and opening fire again, claiming more victims.

Witnesses and surveillance videos of the suspect’s getaway car led authorities to his home, near the scene of the second attack, where he was found dead near his 72-year-old mother, said Peter Beuth, the interior minister for the state of Hesse.

READ MORE: Donald Trump 'offered Julian Assange a pardon for Russia denial'

A website believed to be the 43-year-old suspect’s is being evaluated, Mr Beuth said.

“Initial analysis of the webpage of the suspect indicate a xenophobic motivation,” he added.

He said federal prosecutors have taken over the investigation of the crime and are treating it as an act of domestic terrorism.

“This is an attack on our free and peaceful society,” he said.

Some of the victims are believed to be Turkish, and Turkey’s foreign minister Mevlut Cavusoglu said the consulate in Frankfurt and the embassy in Berlin are trying to obtain information on the attack.

“According to the initial information, it was an attack with a racist motive, but we would need to wait for the (official) statement,” he told state television TRT.

German news agency dpa reported that police are examining a video the suspect may have posted online several days ago, detailing a conspiracy theory about child abuse in the US.

On a website registered by someone with the same name as the man in the video, Tobias R, the owner says he was born in Hanau in 1977 and grew up in the city, later training with a bank and completing a business degree in 2007.

The attack comes amid growing concerns about far-right violence in Germany.

Chancellor Angela Merkel called off a planned visit on Thursday to a university in Halle. Her spokesman, Steffen Seibert, said she was “being constantly kept abreast of the state of the investigations in Hanau”.

Halle was the site of a deadly anti-Semitic attack last year. A man expressing anti-Jewish views tried to shoot his way into a synagogue, failed and killed two passers-by before being arrested.

The shooting in Halle came months after the killing of a regional politician from Ms Merkel’s party. The suspect had a long history of neo-Nazi activity and convictions for violent crime.

“Thoughts this morning are with the people of Hanau, in whose midst this terrible crime was committed,” Mr Seibert said on Twitter. “Deep sympathy for the affected families, who are grieving for their dead. We hope with those wounded that they will soon recover.”

In addition to those killed, Mr Beuth said one person was seriously wounded and multiple others suffered less serious injuries.

Police officers earlier swarmed central Hanau, cordoning off the area of one of the shootings as a helicopter hovered overhead. A car covered in thermal foil also could be seen, with shattered glass next to it. Forensic experts in white overalls collected evidence.

Hookah lounges are places where people gather to smoke flavoured tobacco from Middle Eastern water pipes.

READ MORE: Brits on quarantined cruise ship to be flown home on Friday

“This was a terrible evening that will certainly occupy us for a long, long time and we will remember with sadness,” Hanau mayor Claus Kaminsky told the Bild newspaper.

Legislator Katja Leikert, a member of Ms Merkel’s centre-right party who represents Hanau in the German parliament, tweeted that it was “a real horror scenario for us all”.

Hanau is about 12 miles east of Frankfurt, and has about 100,000 inhabitants.