The Trump administration’s approval of Kentucky’s strict Medicaid work requirement, set to go into effect July 1, was vacated on Friday by a federal judge in Washington D.C. and sent back to the Department of Health and Human Services for reconsideration.

In a sweeping ruling striking down the entirety of Kentucky’s Medicaid waiver, U.S. District Judge James Boasberg sided with the dozen-plus low-income Kentuckians who had challenged the new rules, and said that the Trump administration acted in an “arbitrary and capricious” manner by approving them.

“The Secretary never adequately considered whether Kentucky HEALTH would in fact help the state furnish medical assistance to its citizens, a central objective of Medicaid,” Boasberg wrote, later adding that HHS “entirely failed to consider Kentucky’s estimate that 95,000 persons would leave its Medicaid rolls during the 5-year project.”

The HHS Secretary’s failure to acknowledge the likely coverage losses the rules would trigger, the judge wrote, “gives the Court little reason to think that he seriously grappled with the bottom-line impact on healthcare.”

Though far from the final word on the matter, Friday’s ruling is a resounding defeat for the Trump administration’s health agenda, of which Medicaid work requirements has been a top priority. Following the failure of the GOP-controlled Congress to repeal the Affordable Care Act and abolish its optional expansion of Medicaid, the administration has turned to the state Medicaid waiver process, approving policies that will deny health coverage to hundreds of thousands of people.

“Today’s decision is disappointing,” said Medicaid Administrator Seema Verma following the ruling. “We are conferring with the Department of Justice to chart a path forward. In the meantime, we will continue to support innovative, state-driven policies that are designed to advance the objectives of the Medicaid program by improving health outcomes for thousands of low-income Americans.”

Kentucky was the first state in the nation, and in the nation’s history, to win permission from the federal government to implement Medicaid work requirements. Three other states have since followed: Indiana, Arkansas and New Hampshire. Nearly a dozen are currently awaiting approval from the Trump administration.

Friday’s victory for the plaintiffs — who were represented by the National Health Law Program, the Kentucky Equal Justice Center and the Southern Poverty Law Center — will likely inspire similar lawsuits in those other states.

Kentucky’s waiver, had it been allowed to go into effect, would have denied coverage to non-disabled state residents who could not prove they were working at least 80 hours per month. It would also have charged low-income Medicaid recipients health care premiums, eliminated full coverage of dental care, vision services, and over-the-counter medications for many adults, ended retroactive Medicaid coverage, and implemented a six-month lockout period for people who failed to re-enroll in time or report a change in income.

Kentucky’s Republican Gov. Matt Bevin has repeatedly threatened to abolish his state’s Medicaid expansion entirely if the work requirements waiver was struck down in court. Attorneys for his administration even brought this threat into Judge Boasberg’s courtroom, arguing that any harm done to the plaintiffs was not “redressable” because they would lose their Medicaid either way, and warning the judge that his ruling could cause widespread damage in Kentucky and in other states considering expanding Medicaid.

Judge Boasberg took a dim view of that line of argument, saying that Kentucky’s threat to terminate the Medicaid expansion would only happen after all legal appeals in the case are exhausted, if it happens at all.

“Kentucky tries to muddy the waters,” he wrote in his opinion. “Even if Kentucky were able to ‘unexpand’ Medicaid (far from a foregone conclusion), Plaintiffs would have, at minimum, momentary relief.”

Boasberg also wrote scathingly of the Trump administration’s claim that its Medicaid waiver decisions were not reviewable by courts.

If that were true, he said, “The Secretary could singlehandedly rewrite the Medicaid Act. Imagine, for instance, that he approved a demonstration project targeting the blind. He could then waive Section 1396a’s requirement that a state (or all states) cover blind people. The Secretary promised at oral argument that he would not do so, but what’s to stop him?”

The court’s ruling Friday comes on the heels of a new study by the Kaiser Family Foundation that found that as many as four million people would lose their coverage if similar rules were adopted nationwide. The majority of those people, Kaiser found, would be people who are working but who have difficulty navigating the system of documenting and reporting that work to the state.

“Most disenrollment would be among individuals who would remain eligible but lose coverage due to new administrative burdens or red tape versus those who would lose eligibility due to not meeting new work requirements,” the study found.

Read the court’s full ruling below: