SAN FRANCISCO — Online review site Yelp.com cannot be ordered to remove posts against a San Francisco law firm that a judge determined were defamatory, a divided California Supreme Court ruled Monday in a closely watched case that internet companies had warned could be used to silence online speech.

Justices agreed in a 4-3 opinion, saying removal orders such as the one attorney Dawn Hassell obtained against Yelp "could interfere with and undermine the viability of an online platform."

The decision overturned a lower court ruling that Yelp had said could lead to the removal of negative reviews from the popular website and leave consumers with a skewed assessment of restaurants and other businesses.

Hassell said Yelp was exaggerating the stakes of her legal effort.

Her attorney, Monique Olivier, said in a statement that the ruling "stands as an invitation to spread falsehoods on the internet without consequence."

She said her client was considering an appeal to the U.S. Supreme Court.

Hassell's 2013 lawsuit accused a client she briefly represented in a personal injury case of defaming her on Yelp by falsely claiming that her firm failed to communicate with the client, among other things.

San Francisco Superior Court Judge Donald Sullivan found the online statements defamatory and ordered the client and Yelp to remove them. Hassell said the client failed to answer her lawsuit or remove the posts, so she had to seek a court order demanding that Yelp do it.

A second judge and a state appeals court upheld Sullivan's order.

"Ms. Hassell did exactly what she should have done," Olivier said Monday. "After both the defamer and Yelp refused to remove untrue and damaging statements, she obtained a judgment against the defamer, and sought to enforce that judgment by requiring Yelp to remove the defamation."

Yelp said the lower court ruling would give businesses unhappy about negative reviews a new legal pathway for getting them removed.

Aaron Schur, a deputy general counsel for Yelp, wrote in a blog statement that Monday's decision assures online publishers in California that they "cannot be lawfully forced to remove third-party speech through enterprising abuses of the legal system."

Internet giants Facebook, Twitter and Microsoft said in a letter to the California Supreme Court that the lower court ruling "radically departs from a large, unanimous and settled body of federal and state court precedent" and could be used to "silence a vast quantity of protected and important speech."

Three of the California Supreme Court justices agreed with Yelp that the removal order violated a 1996 federal law that courts have widely interpreted as prohibiting internet companies from being treated as the speaker or publisher of users' posts.

"In substance, Yelp is being held to account for nothing more than its ongoing decision to publish the challenged reviews," Chief Justice Tani Cantil-Sakauye said in an opinion joined by associate justices Ming Chin and Carol Corrigan.

Associate Justice Leondra Kruger agreed that the removal order against Yelp was invalid, but for a different reason.

In a dissenting opinion, Associate Justice Mariano-Florentino Cuellar said nothing in the 1996 federal law allows Yelp to "ignore a properly issued court order meant to stop the spread of defamatory or otherwise harmful information on the internet."

"Even — indeed, perhaps especially — in a society that values free expression, people expect courts and statutes to offer them minimal protections from disparaging misrepresentations or abject lies deliberately circulated to the public," he wrote.

The dissent raises important questions about how to govern the internet, said Eric Goldman, co-director of the High Tech Law Institute at Santa Clara University School of Law.

Still, Goldman said the court of appeal ruling upholding the removal order against Yelp was an "outlier" and would have led to "open season on internet companies."