SAN FRANCISCO — In a win for internet and social media companies, a California court of appeal on Wednesday ruled that Facebook Inc. cannot be penalized for posting advertisements next to a user-generated page critical of the “country-rap” singer Mikel Knight.

The unanimous decision by a panel of the First Appellate District court overturns a trial court decision that critics had said undermined the ad-supported economic model of a whole host of internet companies and exposed them to a wave of “right of publicity” litigation.

“There are a lot of both statutes and doctrines designed to make it more difficult [for people] to challenge speech online about them that they simply don’t like,” said Daniel Nazer, a staff attorney at the Electronic Frontier Foundation. “The lower court’s ruling took the right of publicity and just drove a Mack truck through all of that. It’s good to see it reversed.”

The legal battle between Facebook and Knight, whose real name is Jason Cross, arose after two vans operated by the singer’s record label to promote his music were involved in separate traffic accidents in June 2014. The accidents had tragic consequences, leading to two deaths and one serious injury, according to the court ruling.

Not long after, a publicly available Facebook page called “Families Against Mikel Knight” was created, apparently by relatives of the victims. Knight requested that Facebook pull down the page, saying he and his promoters were receiving threats and that the page was impacting his business prospects, but Facebook declined. Knight sued in February 2016.

The San Mateo trial court dismissed several of Knight’s claims under California’s anti-SLAPP statute, saying the singer was unlikely to succeed on them because of the immunities granted to web forums under Section 230 of the Communications Decency Act. But it declined to do so for three other claims relating to right to publicity, holding open that Knight could succeed on claims that Facebook “used” his name and likeness by running unrelated ads next to the public page.

In overturning that decision, Acting Presiding Justice James Richman wrote for the panel that Knight’s claims were “conclusory” and undermined by the rest of the allegations in his complaint.

“Knight has not even alleged—let alone shown—that any advertiser used his name or likeness. He thus cannot establish that anyone, let alone Facebook, obtained an advantage through use of his identity,” Richman wrote. “At most, Knight has shown that Facebook allowed unrelated third-party advertisements to run adjacent to pages containing users’ comments about Knight and his business practices. This is insufficient.”

Joining the opinion were Justices Therese Stewart and Marla Miller.

Knight was represented by Mark Punzalan of Punzalan Law in San Mateo and Todd Cole of the Cole Law Group in Nashville. They could not immediately be reached for comment on Wednesday afternoon.

Natalie Naugle, associate general counsel at Facebook, said in a statement that the company is “pleased with the decision.” Facebook is represented by Perkins Coie and Durie Tangri in the litigation.

The trial court judge had also ruled that the right to publicity “protects a form of intellectual property,” and thus Section 230 immunity does not apply because of a carve-out in the law for IP — a notion that critics like the Electronic Frontier Foundation had challenged in an amicus brief. But the appeals court panel declined to address that issue because of its other findings.