A logo of Twitter is pictured next to the logo of Facebook in this September 23, 2014 illustration photo in Sarajevo. REUTERS/Dado Ruvic/Files

BERLIN (Reuters) - Germany said on Tuesday that Facebook, Google and Twitter have agreed to delete hate speech from their websites within 24 hours, a new step in the fight against rising online racism following the refugee crisis.

The government has been trying to get social platforms to crack down on the rise in anti-foreigner comments in German on the web as the country struggles to cope with an influx of more than 1 million refugees this year.

The new agreement makes it easier for users and anti-racism groups to report hate speech to specialist teams at the three companies, German Justice Minister Heiko Maas said.

“When the limits of free speech are trespassed, when it is about criminal expressions, sedition, incitement to carry out criminal offences that threaten people, such content has to be deleted from the net,” Maas said. “And we agree that as a rule this should be possible within 24 hours.”

Germany last month launched an investigation into the European head of Facebook over its alleged failure to remove racist hate speech.

Martin Ott, Facebook’s managing director for northern, central and eastern Europe based in Hamburg, may be held responsible for the social platform’s failure to remove hate speech, a spokeswoman for the prosecution said last month.

A Facebook spokesperson said the allegations lack merit and there has been no violation of German law by Facebook or its employees.

Facebook has a partnership with a group called FSM, which monitors multimedia service providers on a voluntary basis, and has said it would encourage its users to push back against racism.

Vandals attacked its offices in the northern city of Hamburg at the weekend, damaging the entrance to the building and spraying “Facebook dislike” on a wall.