WILMINGTON, Del(Reuters) - Local governments in regions hard hit by the U.S. opioid epidemic have opted out of massive litigation taking aim at the drug industry over the crisis, potentially weakening a novel legal mechanism created to help settle thousands of lawsuits.

FILE PHOTO: A full syringe, empty syringe and spoon sit on the roof of the car in which a man in his 20's overdosed on an opioid in the Boston suburb of Lynn, Massachusetts, U.S. August 14, 2017. REUTERS/Brian Snyder

Overall, 98% of some 34,000 local governments agreed to be bound by a class action against companies such as drug distributor McKesson Corp, drugmaker Johnson & Johnson and pharmacy chain Walgreens Boots Alliance Inc, according to a Monday court filing.

However, the 541 local governments that opted out included Florida’s Palm Beach County and counties in West Virginia, according to attorneys, raising the prospect that companies could face expensive trials even if they settled with the class. The two regions are among the hardest hit by the crisis, which has contributed to more than 400,000 deaths since 1997.

Officials from Houston’s Harris County, one of the largest U.S. counties, have said it would opt out, meaning they would pursue their own lawsuit and not receive funds from a nationwide settlement.

The court filing did not identify opt-outs.

U.S. Judge Dan Polster in Cleveland, who has been overseeing 2,600 consolidated opioid lawsuits, is pushing hard for a settlement to help get funds to those most in need in a timely fashion. He approved the novel “negotiation class” as a way to reassure companies that any deal to resolve the lawsuits would bind remaining governments and prevent them from filing a case.

The lawsuits generally allege that drugmakers improperly marketed opioids while distributors and pharmacy chains failed to stop suspicious orders. The defendants deny the allegations.

Typical class actions allow members to opt out after a settlement has been reached, but the negotiation class fixes the members first. Any settlement must be approved by 75% of the class.

Lawyers said towns and counties less affected by the crisis had little reason to opt out, while areas ravaged by opioids, like West Virginia, had more incentive to pursue and control their own lawsuit.

The number of opt-outs represented around 20% of those that have already sued and could be significant if it included large cities, according to Elizabeth Burch, a professor at the University of Georgia School of Law.

“If I’m trying to negotiate with a town of 80, that’s very different from Houston,” she said.

The negotiation class was opposed by some state attorneys general and drug distributors, and faces a legal challenge at the 6th U.S. Circuit Court of Appeals in Cincinnati.