Leah Millis / Getty

Two years ago, Chief Justice John Roberts gave the Trump administration a very important piece of advice: When you come to the Supreme Court, you need to do your homework.

In his majority opinion sanctioning the Trump administration’s travel ban, Roberts disregarded Trump’s public statements that “Islam hates us,” and that America has problems “with Muslims coming into the country,” because the ultimate text of the travel ban issued by the administration “says nothing about religion.” Rather, Roberts wrote, the ban “reflects the results of a worldwide review process undertaken by multiple Cabinet officials and their agencies.”

At the time, I found it shocking that the chief justice was essentially telling the Trump administration that it could turn the president’s prejudices into public policy with adequate lawyering and sufficient legal pretext. I assumed that the administration would do the necessary work of providing pretenses for its decisions, in order to achieve the policy outcome it desired. What I did not expect was that the Trump administration would not even bother to do that much.

On Thursday, Roberts joined with the four Democratic appointees on the Court to invalidate the Trump administration’s decision to repeal the Obama-era Deferred Action for Childhood Arrivals policy, which has shielded about 700,000 undocumented immigrants brought to the U.S. as children from deportation. The decision states that the Trump administration has the power to rescind the policy, but that the “arbitrary and capricious” manner in which it did so violated the Administrative Procedure Act, which governs decisions made by government agencies. The Department of Homeland Security, Roberts writes, was obliged to consider all of its options before repealing DACA wholesale. “Making that difficult decision was the agency’s job,” Roberts argues, “but the agency failed to do it.”

Roberts, as in previous cases, rejected out of hand the notion that the DACA repeal was motivated by animus, dismissing the president’s numerous derogatory statements about immigrants as “remote in time and made in unrelated contexts.” Justice Sonia Sotomayor retorted in a separate and individual concurrence, “I would not so readily dismiss the allegation that an executive decision disproportionately harms the same racial group that the President branded as less desirable mere months earlier.” Roberts’s decision does not voice opposition to prejudice, the harm the Trump administration’s decision would cause, or DACA’s repeal itself. Rather, he wrote that the Trump administration simply did not do the minimum amount of work required to implement its desired policy.

This is not the first time the Trump administration has been foiled by incompetent governance—federal courts have repeatedly ruled against the Trump administration for failing to follow proper procedure, resulting in “an extraordinary record of legal defeat,” as The Washington Post puts it. In the case challenging the Trump administration’s effort to use the census to effect a nationwide racial gerrymander, Roberts rejected the plainly dishonest pretext that the Trump administration was merely trying to enforce the Voting Rights Act. As with the DACA case, the issue was not the decision the Trump administration made, but its incompetence in making it.

Shortly before that decision was issued, files found on the hard drive of the deceased conservative operative Thomas Hofeller revealed that the census scheme was an attempt to enhance the political influence of white voters at minority voters’ expense. Although he did not mention the Hofeller files in his decision, Roberts wrote that the justices are “not required to exhibit a naiveté from which ordinary citizens are free.”

These cases have revealed Roberts as a bulwark against Trumpism on the Court, not because he is ideologically hostile to it, but because Roberts expects the federal government to adhere to minimum standards of honesty and fidelity to the public interest. These qualities are compatible with conservative governance but are anathema to Trumpism, an ideology wherein the whims of the executive take precedence over the rule of law. What is painfully clear is that the Trump administration could have prevailed in each of these cases, with Roberts’s express approval, had it comported itself with a minimum of good faith.

The conservative movement has come to view Republican-appointed justices as wholly owned subsidiaries of their party, and by extension, the administration. That assumption has lulled it into the mistaken belief that the shoddiest legal reasoning can pass muster at the high court, simply because of the ideological predilections of the Republican appointees. This belief is not entirely without merit—although one Trump appointee, Neil Gorsuch, has an independent streak, in all of the previous cases mentioned here, four Republican appointees were willing to go along with whatever flimsy or dishonest pretext the Trump administration could cobble together. But John Roberts remains hostile to being made to look a fool.

Nevertheless, the Trumpist right is but one vote away from something close to the rubber-stamp Court it would like to see. Should Trump prevail in November, it may get its way after all.

This story is part of the project “The Battle for the Constitution,” in partnership with the National Constitution Center.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.