A federal judge on Thursday blocked a Trump administration effort to undermine part of the Affordable Care Act.

It was the second time in as many days a judge declared that President Donald Trump had taken his war on Obamacare too far, exceeding executive authority and violating the intent of several laws.

On Wednesday, the issue had been the ACA’s expansion of Medicaid ― in particular, the Trump administration’s support of “work requirements” for people who get insurance through the program. In a pair of rulings, the judge declared that such requirements in Arkansas and Kentucky were “arbitrary and capricious” because officials had not demonstrated they further Medicaid’s basic mission, “the provision of medical coverage to the needy.”

On Thursday, the subject was a set of new regulations for “association health plans,” a form of private insurance that allows small employers to band together and buy or sponsor private insurance plans as one group ― in effect, giving them the kind of buying advantages that large employers have.

AHPs are not subject to the same regulations that the Affordable Care Act places on insurance that individuals and small businesses buy on their own. They don’t have to cover all 10 of the law’s “essential benefits,” for example, and they have a lot more freedom to vary premiums based on factors like age, occupation or gender.

The federal government had historically limited AHPs to small businesses in a common line of work, such as restaurant franchises. The Trump administration decided last year to loosen those restrictions significantly, so that small employers with nothing in common other than geography could form AHPs ― and so self-employed individuals could join as well.

Basically, it opened up these less regulated insurance plans to a much larger group of people.

And that was illegal, Senior U.S. District Judge John Bates ruled on Friday. The Affordable Care Act seeks to regulate insurance for individuals and small businesses, he noted. AHPs may be exempt from those regulations, but only for small firms that are actually in the same line of business ― and that are small companies, rather than individuals.

“The Final Rule is clearly an end-run around the ACA,” Bates wrote.

Trump has long talked up AHPs in the same way that conservatives have, by promoting them as a cheaper alternative for individuals and small businesses struggling with high premiums. But the policies could leave beneficiaries exposed to bigger, potentially crippling medical bills, because the plans don’t have to cover all of the essential benefits. The plans could also draw healthier people away from more comprehensive policies, forcing insurers to raise prices on those policies, which people with ongoing medical problems need in order to cover their expenses.

“Any savings that AHPs offer to healthier-than-average firms and workers likely come at the expense of higher costs for sicker-than-average firms and workers who remain in the ACA small-group and individual markets,” Sarah Lueck, senior policy analyst at the Center on Budget and Policy Priorities, explained earlier this month.

The administration could decide to appeal the Bates decision. If it does, the case could end up in the hands of the Supreme Court and its five-member conservative majority. But Bates is also a relatively conservative judge. A Republican president, George W. Bush, put him on the bench.

That hardly guarantees the ruling will hold up on appeal. But together with Wednesday’s ruling, it suggests that Trump’s attempts to undermine the 2010 health care law are pushing the boundaries of what’s constitutionally and legally permissible ― and quite possibly exceeding them.

CORRECTION: A previous version of this article misidentified Judge John Bates as Andrew Bates.