A German federal court has criticised Facebook for how it moderates content and handles "hate speech".
The court said the social network cannot delete posts without at least informing users, and must give advance notice when it moves to suspend any accounts.
The ruling by the Federal Court of Justice follows two cases brought against Facebook after the platform deleted comments which took aim at Muslim migrants and other refugees.
Facebook had removed the posts and suspended the users' accounts, but on Thursday, it was ordered to restore the comments.
Judges said that Facebook was not entitled to take action under its April 2018 "community standards" because its rules were not precisely defined.
"Users of the network are inappropriately disadvantaged, contrary to the requirement of good faith," the court said in its judgment.
Facebook is, in principle, entitled to set standards that go above and beyond legal requirements, but it must inform a user at least after they have removed a post.
The social network must also give notice of plans to suspend an account, giving the user a reason for the suspension and the possibility to respond, the court added.
Facebook said in a statement that they welcomed the court's ruling and were entitled to remove content according to its own policies.
"We will examine the decision of the Federal Court of Justice carefully to ensure that we can continue to act effectively against hate speech in Germany," a spokesperson said.