ATLANTA, GA - OCTOBER 05:  A podium with the logo for the Centers for Disease Control and Prevention  at the Tom Harkin Global Communications Center on October 5, 2014 in Atlanta, Georgia. The first confirmed Ebola virus patient in the United States was staying with family members at The Ivy Apartment complex before being treated at Texas Health Presbyterian Hospital Dallas. State and local officials are working with federal officials to monitor other individuals that had contact with the confirmed patient.  (Photo by Kevin C. Cox/Getty Images)
ATLANTA, GA - OCTOBER 05: A podium with the logo for the Centers for Disease Control and Prevention at the Tom Harkin Global Communications Center on October 5, 2014 in Atlanta, Georgia. The first confirmed Ebola virus patient in the United States was staying with family members at The Ivy Apartment complex before being treated at Texas Health Presbyterian Hospital Dallas. State and local officials are working with federal officials to monitor other individuals that had contact with the confirmed patient. (Photo by Kevin C. Cox/Getty Images)
PHOTO: Kevin C. Cox/Getty Images North America/Getty Images
Now playing
02:34
CDC: US life expectancy declined from 2016 to 2017
PHOTO: CNN
Now playing
03:33
Dr. Gupta discusses transmissibility of new Covid-19 variants
Alabama Tornado Damage 0126
Alabama Tornado Damage 0126
PHOTO: WBMA
Now playing
02:00
Tornado rips through north Birmingham, Alabama area
PHOTO: Senate TV
Now playing
06:32
House delivers Trump impeachment article to Senate
Biden US China tech war Wang pkg intl hnk vpx_00010025.png
Biden US China tech war Wang pkg intl hnk vpx_00010025.png
Now playing
02:37
US-China tech rivalry will likely continue under Biden presidency. Here's why
US President Joe Biden delivers remarks before signing an Executive Order in the South Court Auditorium at the White House on January 25, 2021 in Washington, DC. (Photo by JIM WATSON / AFP) (Photo by JIM WATSON/AFP via Getty Images)
US President Joe Biden delivers remarks before signing an Executive Order in the South Court Auditorium at the White House on January 25, 2021 in Washington, DC. (Photo by JIM WATSON / AFP) (Photo by JIM WATSON/AFP via Getty Images)
PHOTO: Jim Watson/AFP/Getty Images
Now playing
02:50
Biden thinks US can get to 1.5 million vaccine doses daily
diegal
diegal
PHOTO: CNN
Now playing
02:58
Former Republican: We've got a bankrupt party
Virgina Mason advanced registered nurse practitioner Erin Forsythe loads a syringing with the Pfizer Covid-19 vaccine during a partnership with the hospital network and Amazon to increase the efficiency of vaccinations, at the Amazon Meeting Center in downtown Seattle, Washington on January 24, 2021. - Amazon is partnering with Virginia Mason for a one-day pop-up clinic on January 24. 2021 that aims to vaccinate 2,000 people at the companys Meeting Center near downtown Seattle. Virginia Mason is handling vaccine administration, while Amazon is providing the location and help with logistics. (Photo by Grant HINDSLEY / AFP) (Photo by GRANT HINDSLEY/AFP via Getty Images)
Virgina Mason advanced registered nurse practitioner Erin Forsythe loads a syringing with the Pfizer Covid-19 vaccine during a partnership with the hospital network and Amazon to increase the efficiency of vaccinations, at the Amazon Meeting Center in downtown Seattle, Washington on January 24, 2021. - Amazon is partnering with Virginia Mason for a one-day pop-up clinic on January 24. 2021 that aims to vaccinate 2,000 people at the companys Meeting Center near downtown Seattle. Virginia Mason is handling vaccine administration, while Amazon is providing the location and help with logistics. (Photo by Grant HINDSLEY / AFP) (Photo by GRANT HINDSLEY/AFP via Getty Images)
PHOTO: Grant Hindsley/AFP/Getty Images
Now playing
02:20
Coronavirus cases and hospitalizations plateau across US
WASHINGTON, DC - AUGUST 10:  The Trump International Hotel is shown on August 10, 2017 in Washington, DC.  The hotel, located blocks from the White House, has become both a tourist attraction in the nation
WASHINGTON, DC - AUGUST 10: The Trump International Hotel is shown on August 10, 2017 in Washington, DC. The hotel, located blocks from the White House, has become both a tourist attraction in the nation's capital and also a symbol of President Trump's intermingling of business and politics. (Photo by Win McNamee/Getty Images)
PHOTO: Win McNamee/Getty Images
Now playing
01:56
Why SCOTUS is dismissing emolument cases against Trump
TAMPA, FL - AUGUST 29:  U.S. Sen. Rob Portman (R-OH) waves during the third day of the Republican National Convention at the Tampa Bay Times Forum on August 29, 2012 in Tampa, Florida. Former Massachusetts Gov. Former Massachusetts Gov. Mitt Romney was nominated as the Republican presidential candidate during the RNC, which is scheduled to conclude August 30.  (Photo by Mark Wilson/Getty Images)
TAMPA, FL - AUGUST 29: U.S. Sen. Rob Portman (R-OH) waves during the third day of the Republican National Convention at the Tampa Bay Times Forum on August 29, 2012 in Tampa, Florida. Former Massachusetts Gov. Former Massachusetts Gov. Mitt Romney was nominated as the Republican presidential candidate during the RNC, which is scheduled to conclude August 30. (Photo by Mark Wilson/Getty Images)
PHOTO: Mark Wilson/Getty Images
Now playing
02:16
GOP senator explains why he won't seek reelection
Now playing
02:26
See Biden sign executive order lifting transgender military ban
PHOTO: WTHR
Now playing
00:40
Officials: Pregnant woman among 5 killed in 'mass murder'
PHOTO: CBS
Now playing
01:46
Dr. Birx: Trump presented graphs that I never made
PHOTO: CNN
Now playing
03:25
Biden's HHS secretary pick: If we do this, we will get the pandemic under control
Unit photography of CNN 35 year anniversary documentary photographed on Monday, April 20, 2015 in Los Angeles, CA. Subjects were former CNN anchors Larry King and Jim Moret.

Photo by John Nowak/CNN
Unit photography of CNN 35 year anniversary documentary photographed on Monday, April 20, 2015 in Los Angeles, CA. Subjects were former CNN anchors Larry King and Jim Moret. Photo by John Nowak/CNN
PHOTO: John Nowak/CNN
Now playing
02:38
Larry King's CNN legacy
WASHINGTON, DC - FEBRUARY 06: Rep. Alexandria Ocasio-Cortez (D-NY) attends a press conference with Rep. Andy Levin (D-MI) about their new bill called the EV Freedom Act on Capitol Hill on February 6, 2020 in Washington, DC. The EV Freedom Act is a plan to create a nation wide charging infrastructure for electric vehicles. (Photo by Samuel Corum/Getty Images)
WASHINGTON, DC - FEBRUARY 06: Rep. Alexandria Ocasio-Cortez (D-NY) attends a press conference with Rep. Andy Levin (D-MI) about their new bill called the EV Freedom Act on Capitol Hill on February 6, 2020 in Washington, DC. The EV Freedom Act is a plan to create a nation wide charging infrastructure for electric vehicles. (Photo by Samuel Corum/Getty Images)
PHOTO: Samuel Corum/Getty Images
Now playing
03:35
Rioter charged with threatening to 'assassinate' Ocasio-Cortez, officer
Now playing
07:26
'What research did you do?': Brown presses GOP lawmaker on election fraud claims
(CNN) —  

In a scathing decision, a federal judge blasted a subsidiary of the nation’s largest insurance company for focusing on the “bottom line as much or more” than patients’ health, saying the insurer illegally denied treatment to thousands of people. The judge also slammed the company’s medical directors for being “deceptive” under oath.

US Chief Magistrate Judge Joseph Spero issued his decision Tuesday against United Behavioral Health, a unit of UnitedHealthcare, saying the insurer created internal policies that effectively discriminated against those seeking mental health and substance abuse treatment.

“It is well-established that effective treatment of mental health and substance use disorders includes treatment aimed at preventing relapse or deterioration of the patient’s condition and maintaining the patient’s level of functioning. UBH Guidelines deviate from that standard,” Spero said.

Legal observers called the decision one of the most important and most thorough rulings ever issued against an insurance company, at the federal level, on mental health issues.

Patrick Kennedy, the former US representative from Rhode Island who has long championed mental health issues, called the ruling “breathtaking” in its scope. For the mental health community, he equated it to the landmark 1954 Supreme Court decision that found racial segregation in public schools unconstitutional.

“This ruling is the Brown v. Board of Education for the mental health movement,” Kennedy said. “The insurance industry is hellbent on violating the federal law, and they’re doing so with impunity. Now, we have a federal court specifically and forensically breaking down how they get around the federal law.”

The class-action suit was brought on behalf of more than 50,000 people denied coverage by United Behavioral Health, the country’s largest managed behavioral health care organization.

Spero took more than a year to issue his 106-page decision. In addition to finding federal violations, Spero ruled that United Behavioral Health violated state laws in Illinois, Connecticut, Rhode Island and Texas.

The judge blasted United Behavioral Health’s medical directors and other expert witnesses who set the company’s policies – naming each one before shredding them as not credible and discounting their testimony.

“UBH’s experts, on the other hand, had serious credibility problems,” Spero wrote. “The Court found that with respect to a significant portion of their testimony each of them was evasive – and even deceptive – in their answers when confronted with contrary evidence.”

He said one board-certified psychiatrist and senior medical director, whose duties included supervising and training United Behavioral Health care advocacy clinicians, “was not always credible because in several instances he ignored the plain meaning of the words used in the Guidelines.”

Another United Behavioral Health expert whose duties included drafting coverage determination guidelines, the judge said, implemented a “model that keeps benefit expenses down by placing a heavy emphasis on crisis stabilization and an insufficient emphasis on the effective treatment of co-occurring and chronic conditions.”

The judge said such decisions had real impacts on patients because United Behavioral Health ignored “effective treatment of members’ underlying condition” and that “UBH knowingly and purposefully drafted its Guidelines to limit coverage to acute signs and symptoms.”

“Research has demonstrated that patients with mental health and substance use disorders who receive treatment at a lower level of care than is clinically appropriate face worse outcomes than those who are treated at the appropriate level of care,” Spero said in his ruling.

He concluded by saying one of the driving factors for such policy decisions was the company’s profit motivations: “Finally, the evidence at trial established that the emphasis on cost-cutting that was embedded in UBH’s Guideline development process actually tainted the process, causing UBH to make decisions about Guidelines based as much or more on its own bottom line as on the interests of the plan members.”

The ruling was issued in the US District Court for the Northern District of California. It will now move to a remedy phase in which the judge is to determine how the insurer should be punished.

Brian Hufford, one of the lead attorneys for the plaintiffs, said the case peeled back the layers of coverage decisions made by insurers that most policy holders don’t even know happen behind the scenes. He said the judge’s decision highlighted the fact United Behavioral Health was “making decisions that are influenced by their monetary concerns and what profits they can make.”

“This case involved coverage of benefits for the most vulnerable population – people who suffer from mental illness and substance abuse,” Hufford said. “Historically insurance companies have been able to hide that conduct and save money by denying treatment to these people in need.”

Meiram Bendat, an attorney and psychotherapist with the law firm Psych-Appeal who uncovered the guideline flaws, said the ruling was “vindication of what patients, providers, and the plaintiffs have been telling UBH for years – that the nation’s largest mental health insurer has been denying access to care on the false premise that ‘crisis’ should be the litmus test for coverage.”

UnitedHealthcare took issue with the judge’s comments about its medical directors, saying they “followed nationally accepted standards in reviewing these requests.”

“We look forward to demonstrating in the next phase of this case how our members received appropriate care,” UnitedHealthcare said in a written statement. “We remain committed to providing our members with access to the right care for the treatment of mental health conditions and substance use disorders.”

The National Alliance on Mental Illness, or NAMI, the nation’s largest advocacy group for the mentally ill, hailed the decision.

“This is a day NAMI has long awaited,” said Angela Kimball, NAMI’s national director of advocacy and public policy. “For decades, people with mental health conditions have experienced really horrific discrimination at the hands of health insurance plans. They routinely deny mental health care and often with tragic outcomes.”

She added, “This is absolutely an incredibly important decision.”

Speaking to CNN by phone, Kennedy called the judge’s ruling “scathing and breathtaking at the same time. I think, frankly, it can be used to understand how all the insurance companies are doing this.”

Get CNN Health's weekly newsletter

Sign up here to get The Results Are In with Dr. Sanjay Gupta every Tuesday from the CNN Health team.

“Given the fact United is the largest insurer in the country, this is a very disturbing decision, and it has implications for United that they really haven’t come to grips with.”

He said that the decision is made even more important because it comes at a time when life expectancy in America has been going down because of a “public health crisis in mental health and addiction.”

“The notion that the largest insurer in the nation is denying care for a set of illnesses that is the driving reason we have higher death rates in this country,” Kennedy said, “you can’t make this stuff up.”