German President Frank-Walter Steinmeier pledged to renew efforts to tackle anti-Muslim hatred in his country in an end of Ramadan message on Friday.
As the holy month of fasting approached its end, Mr Steinmeier said protecting Muslims was not only the duty of the state but of every individual.
Germany was shaken by a devastating attack in February that left nine people dead, most of whom were Muslims, in the city of Hanau.
Federal prosecutors said a 24-page manifesto written by the shooter pointed to “deeply racist views”.
The president said he had been deeply affected by the crime, which he described as an attack on peaceful coexistence and the values of tolerance, diversity and freedom of worship shared by all Germans.
"Hatred and exclusion, violent attacks targeting Muslims, attacks on mosques - we cannot tolerate this, we cannot allow this," Mr Steinmeier wrote.
Earlier in the day, a church in Berlin opened its doors to Muslims who were unable to fit into their mosque for Friday prayers because of social-distancing measures designed to limit the spread of coronavirus.
The Dar Assalam mosque in the Neukölln district of the German capital normally welcomes hundreds of Muslims to its Friday services. But it can currently only accommodate 50 people at a time under coronavirus restrictions.
The nearby Martha Lutheran church stepped in to help, hosting Muslim prayers in Arabic and German.
"It is a great sign and it brings joy in Ramadan and joy amid this crisis," said Mohamed Taha Sabry, the mosque's imam, who led his congregation in prayer watched over by a stained-glass window depicting the Virgin Mary.
"This pandemic has made us a community. Crises bring people get together."
The church's pastor, Monika Matthias, said she had felt moved by the Muslim call to prayer.
"I took part in the prayer," she said. "I gave a speech in German. And during prayer, I could only say yes, yes, yes, because we have the same concerns and we want to learn from you. And it is beautiful to feel that way about each other."
Places of worship reopened in Germany on May 4 after being shut for weeks under a coronavirus lockdown, but worshippers must maintain a minimum distance from one another of 1.5 metres.