A judge has rejected OxyContin maker Purdue Pharma’s bankruptcy settlement of thousands of lawsuits over the opioid epidemic because of a provision that would protect members of the Sackler family from facing litigation of their own.

The ruling Thursday from U.S. District Judge Colleen McMahon in New York is likely to be appealed by the company, family members and the thousands of government entities that support the plan.

Also read: In pics: Joe Biden presents 3 soldiers with top military award for valor

Purdue sought bankruptcy protection in 2019 as it faced thousands of lawsuits claiming the company pushed doctors to prescribe OxyContin, helping spark an opioid crisis that has been linked to more than 500,000 deaths in the U.S. over the last two decades.

Through the bankruptcy court, it worked out a deal with its creditors. Members of the Sackler family would give up ownership of the company, which would transform into a different kind of entity that would still sell opioids — but with profits being used to fight the crisis. It would also develop new anti-addiction and anti-overdose drugs and provide them at little or no cost.

Sackler family members also would contribute $4.5 billion in cash and charitable assets as part of an overall deal that could be worth $10 billion, including the value of the new drugs, if they’re brought to market.

Also read: US FDA permanently allows mail delivery of abortion pill

Government entities and businesses agreed to use any money they receive fighting the opioid epidemic. The deal also calls for millions of company documents, including communications with lawyers, to be made public.

In return, members of the wealthy family would get protection from lawsuits over their role in the opioid crisis — both the 860 already filed and any others in the future.

Most state and local governments, Native American tribes, individual opioid victims and others who voted said the plan worked out in the bankruptcy court should be accepted.

Also read: Omicron variant now dominant in Florida’s Orange County: Officials

But the U.S. Bankruptcy Trustee’s office, eight state attorneys general and some other entities have been fighting the deal. They argue that it does not properly hold members of the Sackler family accountable and that it usurps states’ ability to try to do so.

A bankruptcy court judge approved the plan over the objections in September. But the opponents appealed to McMahon’s court.

The main issue on the appeal was the lawfulness of the measures that would extend legal protections to family members.

Also read: Jeff Jackson, Iraq war veteran, pulls out of US Senate race in North Carolina

Such “third-party releases” are not used in most bankruptcy cases, but they are common in cases such as Purdue’s, in which the companies involved are burdened with lawsuits and have relatively little value — but their wealthy owners could contribute.

The Purdue deal would not protect family members from any criminal charges. But so far none have been filed, and there are no signs that any are forthcoming, though some activists are calling for charges.

In a hearing, McMahon focused on how Sackler family members transferred $10.4 billion from the privately held Stamford, Connecticut-based company over the decade before the bankruptcy. McMahon wanted to know whether the money was moved in part to ensure a role for the Sacklers in bankruptcy negotiations.