In a surprise setback for small-government conservatives, Chief Justice John Roberts on Wednesday provided the swing vote to save a key piece of the administrative state: judicial deference to agency interpretations of regulations.

That subject may sound arcane, but (for better or for worse) it is the bedrock of the regulatory state as we know it. And prior to today’s surprise, conservatives thought this case was in the bag.

Instead, thanks to Chief Justice Roberts, they lost big. Indeed, as angry as some conservatives still are over Roberts (twice) saving Obamacare, he now has defied expectations to save the administrative state as we know it.

When agencies make regulations—environmental rules, labor standards, health regulations—they’re routinely taken to court. It’s almost part of the process at this point: Either corporations complain that the rules are too strict, or public-interest groups complain that they’re too lax.

But courts don’t look at the rules from scratch. They defer to agencies’ interpretations of the laws they enforce, in what’s called Chevron deference, or to the regulations they have written, in what’s called Auer deference. Auer deference was at issue in today’s case, Kisor v. Wilkie.

“ If courts answer these kinds of questions from scratch, they, not the administrative agencies, would effectively be making the rules. ”

That deference doesn’t mean that the agencies always win, but it means that in ambiguous cases, their interpretation of the statute or rule will prevail if it’s reasonable—even if the court might prefer to interpret it a different way.

The applications of this rule are infinite. Justice Elena Kagan, writing for the majority, gave several real-world examples, ranging from the profound to the absurd. Does truffle paté count as a liquid for airport security? Must wheelchair seating at a basketball game offer sight-lines for when everyone else is standing, or only when everyone else is seated? When is a miner’s lung disease serious enough to trigger health regulations? When can drug companies prohibit generic alternatives from being brought to market?

If courts answer these kinds of questions from scratch, they, not the administrative agencies, would effectively be making the rules. Every challenge to every regulation would mean throwing out the agency’s work and substituting the courts’ judgment for theirs. It would handcuff the administrative state.

Which is precisely the point.

“This case has to be understood against the background of conservatives’ attack on the administrative state,” said Columbia Law School Prof. Gillian Metzger when the case was argued in March. “The attack on Auer deference is to make it harder for agencies to develop coherent, well-functioning regulatory regimes.”

Conservatives thought they had a slam-dunk in this case. They argued that when an agency interprets its own rules, it’s violating the Constitution’s separation of powers. Interpretation of regulations is a judge’s job. Moreover, it’s unfair. As Justice Brett Kavanaugh put it in his opinion today, “Umpires in games at Wrigley Field do not defer to the Cubs manager’s in-game interpretation of Wrigley’s ground rules. So too here.”

But they hadn’t counted on Chief Justice Roberts, and his longstanding commitment to judicial principles like respect for precedent.

While it was Justice Elena Kagan, not Chief Justice Roberts, who wrote the court’s opinion, that opinion focused on stare decisis (“stand by the decision”), the court’s principle that precedents should stand unless they are unworkable and unreasonable. That is the kind of judicial-conservative position that Chief Justice Roberts is, by now, famous (or infamous) for upholding.

Auer deference actually goes back to 1945, when the court held that when “the meaning of [a regulation] is in doubt,” the agency’s interpretation “becomes of controlling weight unless it is plainly erroneous or inconsistent with the regulation.”

That is a longstanding precedent, and, as Justice Kagan noted, it has not proven unworkable in practice.

That being said, the court’s opinion—as Chief Justice Roberts emphasized in his own short concurrence—did draw new limits around Auer deference. The rule in question must be “genuinely ambiguous” according to a court’s interpretation of ambiguity. The interpretation must still be “reasonable.”

And courts can inquire into the “character and context of the agency interpretation.” If there’s evidence in the record that the agency violated administrative procedure, for example, Auer deference would not apply. Likewise, the decision must be adopted by the agency itself, not just an ad hoc statement by a single department. It must be related to the agency’s expertise. And it must represent a “fair and considered judgment.”

Those are serious limitations, to be sure. But the basic principle of agency deference remains in place.

Just look at Justice Neil Gorsuch’s opinion for how upsetting this is to proponents of smaller government. Gorsuch said the rule creates “systematic judicial bias in favor of the federal government, the most powerful of parties, and against everyone else.” It “force[s] litigants and lower courts to jump through needless and perplexing new hoops and in the process den[ies] the people the independent judicial decisions they deserve.” And it was adopted “without ever pausing to consider whether a rule like that could be legally justified or even made sense.”

Those are strong words, but they reflect the profound philosophical and practical issues in play. Justice Gorsuch is being consistent: In a different case today, he sided with the court’s liberals in protecting the constitutional rights of a sex offender; his civil libertarianism is emerging as one of the most interesting features of the court’s current term. And here, he sides with the conservatives to limit the reach of the federal government. Restraining government is paramount.

For Chief Justice Roberts, however, Auer deference comes from a 74-year-old Supreme Court precedent, and that deserves respect.

Finally, today’s decision may prove crucial for the most controversial issue of all: abortion.

This year, the court’s justices have offered widely different understandings of stare decisis. Last month, for example, Justice Clarence Thomas wrote that the doctrine is “‘not an inexorable command” and depends on “the quality of the decision’s reasoning.” That would easily allow for overturning Roe v. Wade and other cases that Justice Thomas believes are of dubious “quality.”

In response, Justice Stephen Breyer wondered “which cases the court will overrule next” under such a flimsy doctrine of precedent.

Today, the court, including Chief Justice Roberts, took a much more robust line. Justice Kagan noted that Auer was rooted in a “long line of precedents” and that “adherence to precedent is ‘a foundation stone of the rule of law.’”

If this approach to stare decisis, rather than Justice Thomas’, is applied to the long line of cases beginning with Roe v. Wade, it would lead to upholding the right to abortion.

Imagine how angry conservatives will be with Chief Justice Roberts then.