Angela Merkel has said the murder of nine people in a shooting rampage by a suspected rightwing extremist has revealed the “poison” of racism and hate in Germany.

The man, identified as Tobias Rathjen, 43, carried out attacks at two shisha bars in Hanau, a commuter town near Frankfurt, before killing his mother, bringing the death toll to 10, and then himself, police said.

Investigators said he a “deeply racist mindset”, citing a video and a lengthy manifesto he had posted on social media. Authorities said they were treating the attacks as an act of domestic terrorism.

All nine of those killed at the shisha bars had an immigrant background, and at least five were Turkish, several of Kurdish origin, prosecutors said. Six others were injured, one of whom had life-threatening injuries. There were unconfirmed reports that a 35-year-old pregnant mother of two was among those who died.

Merkel promised the state would stand up with “strength and decisiveness” to those who try to divide society.

Campaigners for migrant rights in Germany said the attacks were indicative of widespread indifference shown by the state towards rightwing extremism despite evidence that it was on the rise.

“If people are silent for long enough, then things like this will happen,” said Mehmet Daimagüler, a lawyer for victims of far-right terrorism. “You could have set the clock by this attack. People tell us they have learnt from Auschwitz, but this shows that sort of talk is just ‘blah, blah’.”

Play Video 1:11 Footage shows aftermath of deadly shisha bar attacks in Germany – video

Federal prosecutors said they would be taking charge of the investigation, as is normal practice when the state is considered to be endangered by a crime. Investigators aim to establish whether he acted alone or received support from any individuals or groups.

Late on Thursday, the tabloid Bild reported that Rathjen had contacted authorities with his conspiracy theories only three months ago, seemingly contradicting claims that he had not been on intelligence agencies’ radar.

On 6 November, Rathjen wrote to Germany’s general prosecutor and called on authorities to “approach me and communicate with me”. Parts of the 19-page letter were virtually identical to the rambling manifesto published on his website, but it was unclear whether it included any threats against ethnic minorities, the newspaper said.

If confirmed as genuine, the letter will prompt further questions over whether authorities might have been able to intervene to prevent the deadly attack.

According to police, the gunman first drove to a shisha bar called Midnight, on Heumarkt in the centre of Hanau, where he fired about eight or nine shots apparently randomly into the room at about 10pm on Wednesday.

After driving to a second bar called Arena, on Kurt Schumacher Platz in the western district of Kesselstadt, and firing more shots, he drove to a house, believed to be his home, where he shot his 72-year-old mother before shooting himself.

After a frantic search involving dozens of armed police and a helicopter, police were alerted to his parked car in Kesselstadt and quickly matched it to the address and sealed off the area. At around 3am, neighbours heard a large bang as police detonated the front door of the white terraced house, where they found Rathjen’s body and that of his mother. They also found the murder weapon, a spokesman said.

Police said they had no indications that other perpetrators were involved. On Thursday morning they interviewed Rathjen’s father, who is reported to have been in the house when Rathjen returned and who managed to escape.

In a 24-page manifesto and a video, Rathjen outlined his racist theories, including his belief that certain races should be eliminated and foreigners who could not be deported from Germany should be “destroyed”. He said he had been driven by voices in his head since birth and followed by secret agents, and also talked about a wide range of conspiracy theories, including that 9/11 was carried out by the US state, and made claims about his ability to influence the playing tactics of the German national football team.

Police urged any witnesses with mobile phone footage or other information related to the attacks to upload it to a police website, and appealed to the public not to post any evidence on social media.

Claus Kaminsky, the mayor of Hanau, fought back tears as he described the shooting as “the bitterest, saddest experience” the town had suffered since the second world war.

Standing next to him, Volker Bouffier, the premier of the state of Hesse, said most people would feel solidarity with the victims and their families. He said of the attack: “This changes everything. Not only for this city, but for our country.”

Addressing people of an immigrant background, Bouffier said: “I know you are scared … but I want to say to you, we’ll do all we can to act against hate.”

Candlelit vigils were planned across Germany on Thursday evening to pay tribute to those who died and to make a stand against racism.

One expert said domestic intelligence agents believed there were 24,000 rightwing extremists in Germany, 13,000 of whom were considered potentially dangerous.

Michael Ortmann told NTV that investigators in Germany had been slow to recognise a rise in rightwing extremists ready to perpetrate violence, having devoted much of their resources into fighting the threat of Islamist terrorism.

Play Video 1:00 Germany attack: gunman acted on rightwing, racist motives, says Merkel – video

This week German investigators said they had smashed a ring of rightwing extremists who had been plotting to carry out large-scale gun attacks on mosques throughout Germany. The man believed to be the ringleader hoped to trigger a civil war, police said.

Germany is still reeling from an attack on a synagogue in the eastern city of Halle in October in which two people died and several were injured. In June last year, Walter Lübcke, a conservative local politician who had spoken out in defence of refugees, was murdered at his home near Kassel in Hesse.

Olaf Scholz, the finance minister and vice-chancellor, said: “Our political debates cannot duck the fact that 75 years after the end of the Nazi dictatorship, rightwing terror exists in Germany again,.”

Lars Klingbeil, general secretary of the SPD, the junior coalition partner in Merkel’s government, called for an “insurgency of the decent” in which he said ordinary Germans should make a stand against anti-immigrant sentiment.

Robert Lambrou, parliamentary party leader of the anti-immigrant Alternative für Deutschland (AfD) in the state of Hesse, said his party was in a “state of shock” . Asked by a German journalist if he thought the AfD should take any responsibility for the attacks for its use of anti-foreigner rhetoric, Lambou said: “Such horrific murders as this must lead all of us to reflect on how we can avoid such things from happening.”

Merkel pledged that “everything will be done to investigate the circumstances of these terrible murders”. She said the government “and every state institution” would “stand up with all our strength and decisiveness to those people who try to divide Germany.”