By Brendan Pierson

(Reuters) -Leading consulting firm McKinsey & Co has agreed to settle claims by hundreds of U.S. local governments and school districts around the country that it fueled an epidemic of opioid addiction through its work for bankrupt OxyContin maker Purdue Pharma LP and other drug companies.

The deal was disclosed in a court filing Wednesday evening in San Francisco federal court. Its terms were not made public, and McKinsey and a lawyer for the settling plaintiffs did not immediately respond to requests for comment.

McKinsey previously agreed to pay more than $600 million to settle opioid claims brought by all U.S. states and territories, and had argued that those settlements should shield it from local governments’ and school districts’ lawsuits. It has not admitted wrongdoing.

The firm still faces claims by health insurance plans, Native American tribes and families of children exposed to opioids in the womb, which can cause withdrawal symptoms at birth and long-term health and developmental problems. Cases have been filed in multiple states, but are consolidated before U.S. District Judge Charles Breyer in San Francisco for pretrial proceedings.

Breyer on Thursday denied McKinsey’s bid to dismiss the pending cases on the grounds that courts in states where the New York-based company did not directly do business had no jurisdiction over it. Breyer found that they did have jurisdiction because McKinsey “purposefully directed its activities” at those states in its opioid consulting work.

Plaintiffs accuse the company of pushing aggressive tactics to boost opioid sales, including by targeting doctors known to be prolific prescribers.

The U.S. opioid crisis has caused more than 500,000 overdose deaths over two decades, according to federal government data. Litigation against drugmakers, distributors and pharmacies has so far yielded more than $30 billion in settlements, though defendants have not admitted wrongdoing.

(Reporting By Brendan Pierson in New York; Additional reporting by Nate Raymond in Boston; Editing by Daniel Wallis)