Facebook, Twitter and other social media companies will be fined as much as €50 million ($53 million) in Germany if they fail to remove hate speech and fake news posts quickly.

The German cabinet approved a plan to start imposing the fines on Wednesday. The draft bill will still have to be considered by the German parliament and other bodies before it becomes a law.

"The providers of social networks are responsible when their platforms are misused to propagate hate crimes and fake news," justice minister Heiko Maas said in a statement emailed to CNNMoney.

He said that the companies must organize their complaints management in a way that allows obviously criminal content to be deleted promptly.

The companies will have 24 hours to remove hate speech and fake news posts that breach German law after they are flagged by users.

Other illegal content needs to be deleted within 7 days of reporting.

Social networks are already required to remove illegal content from their websites as soon as they are aware of it, according to German law. The new fines, Maas said, are there to make sure they comply with the law.

Related: Google under fire for posting government ads on hate videos

Facebook (FB), Twitter (TWTR), Microsoft (MSFT) and YouTube made a big public promise last May to review a majority of content flagged by users within 24 hours. Any racist, violent or illegal posts would be deleted, they said.

However, German officials said the companies are failing to meet the target.

"Our problem is that too few [pieces of] criminal content are deleted by the social networks," Maas said.

He pointed to a research by Jugendschutz, a German body for the protection of minors on the Internet, which said Facebook only deletes 39% of reported criminal content.

Facebook said it works "very hard to remove illegal content" from its platform and is determined to work with others to solve the problem.

"As experts have pointed out, this legislation would force private companies rather than the courts to become the judges of what is illegal in Germany," it said in a statement.

Twitter was not immediately available to comment on the announcement.

The government holds majority in the parliament and the bill is expected to move through the legislative process swiftly.

Maas said the government wants the bill to become law before the general election in September.

Free speech activists and tech companies have in the past criticized the plan, saying it could damage free speech. Maas said freedom of expression has a "huge meaning" in German democracy. "Even repulsive and ugly utterances -- even lies can be covered by freedom of expression," he said.

"However: freedom of expression ends where criminal law begins...anyone who spreads criminal content on the Internet must be consistently prosecuted and brought to justice," he added.