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) 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.