German Justice Minister Heiko Maas attends the weekly cabinet meeting at the chancellery in Berlin, Germany, Wednesday, April 5, 2017. Germany's Cabinet has approved new rules to ensure that most marriages involving under-18s aren't legally recognized in the country. The issue arose following the influx of migrants to Germany in 2015, and the main aim is to protect girls who were married abroad. (AP Photo/Michael Sohn)

BERLIN (AP) — Germany's Cabinet on Wednesday approved a new bill that punishes social networking sites if they fail to swiftly remove illegal content such as hate speech or defamatory fake news.

Chancellor Angela Merkel's Cabinet agreed on rules that would impose fines of up to 50 million euros (53.4 million dollars) on Facebook, Twitter and other social media platforms.

German Justice Minister Heiko Maas said that the companies offering such online platforms are responsible for removing hateful content. He said the new bill would not restrict the freedom of expression, but intervene only when criminal hatred or intentionally false news are posted.

Germany poses a particular problem for U.S.-owned social networking sites accustomed to American standards of free speech. Due to its Nazi past, Germany bans public Holocaust denial and any overt promotion of racism. The issue has come to the fore amid the recent influx of migrants to Germany, which has sparked a backlash among some Germans including a rise in online vitriol.

Social networks need to ensure that obviously criminal content — as defined by German law — will be deleted within 24 hours and other illegal content after seven days.

"Just like on the streets, there is also no room for criminal incitement on social networks," Maas said.

"The internet affects the culture of debate and the atmosphere in our society. Verbal radicalization is often a preliminary stage to physical violence," he added.

The minister pointed out that social networks don't delete enough punishable content, citing research that he said showed Twitter deletes just 1 percent of illegal content flagged by users, while Facebook deletes 39 percent.

Maas also said that measures to combat hate speech and so-called fake news will ultimately have to be taken at the European level to be effective.

The bill still needs parliamentary approval.