BERLIN (AP) — A German federal court on Thursday faulted aspects of Facebook’s handling of “hate speech,” at least in the past. It ruled that the social network giant can’t delete posts without at least informing users afterward, and must give users advance notice when it moves to suspend their accounts.

The Federal Court of Justice considered two cases dating back to August 2018 in which Facebook deleted comments taking aim at Muslim migrants and people of immigrant origin and suspended the users’ accounts. It ordered the company to restore the posts.

The court found that Facebook wasn’t entitled to delete the posts and suspend the accounts under its April 2018 conditions of use, which barred users from violating “community standards” and banned “hate speech,” which it did not define more precisely. It said that “users of the network are inappropriately disadvantaged, contrary to the requirement of good faith.”

Facebook is entitled in principle to set standards that go above and beyond legal requirements and to reserve the right to delete posts and suspend accounts, the court said. But it must commit itself to informing a user at least after the event about the removal of a post, and to giving advance notice of plans to suspend an account — giving the user a reason for the suspension and the possibility to respond.

Facebook said in an emailed response that it welcomes the federal court’s ruling that it is entitled in principle to remove content according to its own policies and to suspend the accounts concerned.

“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,” it said.