The U.S. Supreme Court, in a decision led by Chief Justice John Roberts, appears to have drawn a welcome and needed line on how far it will go to accommodate President Donald Trump’s desires.

Roberts, in writing the majority opinion, slammed the administration for the “contrived” reasoning it presented in its attempt to add a citizenship question to the census.

The executive branch, Roberts wrote, must “offer genuine justifications for important decisions, reasons that can be scrutinized by courts and the interested public. Accepting contrived reasons would defeat the purpose of the enterprise. If judicial review is to be more than an empty ritual, it must demand something better than the explanation offered for the action taken in this case.”

An empty ritual. Harsh but necessary words that should remind the president and his minions that this country will not easily give up its system of checks and balances. The court has offered to let the administration give a better explanation, but it is unlikely that one will be forthcoming. There has never been a sound rationale for adding the question back into the census for the first time in well over half a century, in large measure because doing so would undermine its primary mission: to count everyone living in the U.S. Not just citizens, but everyone.

Trump, who should be focused on the G-20 summit in Osaka, Japan, instead was tweeting at 2:30 a.m. local time that the decision was “totally ridiculous” and that he had already asked lawyers to “delay the Census, no matter how long.” And here again is where Trump’s dictatorial instincts should hit another roadblock, hamstrung by a power even greater than his — the U.S. Constitution. It mandates a census every decade. The administration itself had sent a July 1 deadline for an answer from the court. As the administration has advised so many others, it’s time to move on.

While the court did not definitively rule against a citizenship question, it did call the Trump administration’s bluff. It would not accept the flimsy explanation from Commerce Secretary Wilbur Ross that the citizenship question was needed to enforce the Voting Rights Act. Previously, three federal judges had ruled that evidence showed that was not true.

This was always a power move at the ultimate gerrymandering: frighten immigrants into not being counted, thus robbing states with immigrant populations of needed federal funds, Electoral College votes and even congressional representation, all of which flow from the census count.

In Minnesota, thankfully, officials made clear immediately that they are gearing up for a full and accurate census count no matter what. Gov. Tim Walz called the Supreme Court decision “a step in the right direction,” but added that his administration is “dedicated to ensuring that every Minnesotan is counted and respected regardless of their immigration status.” Attorney General Keith Ellison has said his office “will continue to use every legal recourse to keep this clearly prejudicial question off the Census in 2020.”

That is commendable, and the right course. But it’s unfortunate that the state must expend its resources preparing for a fight that never should have been started.