PRESIDENT TRUMP’S September 2017 proclamation restricting travel to the United States from a group of mostly Muslim countries presented the following problem for the Supreme Court, and for the country: Conceivably, something resembling this decree might be a proper exercise of the broad power over immigration and national security that Congress has delegated the president. However, the actual president who issued it was Mr. Trump. And as he has made clear in a series of appalling statements before and after he took the oath of office in January 2017, Mr. Trump’s mind is ruled by a hodgepodge of prejudices against Muslims, which pervades his judgment in matters of immigration and national security.

On Tuesday, a five-member majority of the Supreme Court upheld this so-called travel ban. Given that it had been revised twice after flunking judicial and public scrutiny, and now includes various exceptions, and covers not all Muslim nations but only a handful, it could not be said to violate the First Amendment ban against religious discrimination, the court concluded. Nor was it in tension with immigration statutes, which do indeed grant the president wide discretion to ban various entrants.

Chief Justice John G. Roberts Jr.’s opinion noted Mr. Trump’s order’s origins in his December 2015 call for a “total and complete shutdown of Muslims entering the United States” but deferred to the office of the president and its authority. “The issue before us is not whether to denounce the statements,” he wrote. “It is instead the significance of those statements in reviewing a Presidential directive, neutral on its face, addressing a matter within the core of executive responsibility.”

Perhaps there is something to be said for preserving lawful executive discretion for that hoped-for day when it is restored to safer hands. Still, this comes at the price of handing Mr. Trump what he immediately called “a moment of profound vindication following months of hysterical commentary from the media and Democratic politicians who refuse to do what it takes to secure our border and our country.” In fact, in none of its iterations did his policy, lawful or not, represent an effective response to legitimate concerns about terrorism. The administration has yet to present evidence that this ban will make the country safer. The hysteria, if any, was, and still is, Mr. Trump’s, as we saw in his “harrowing” past comments (dissenting Justice Sonia Sotomayor’s apt word), and as we are seeing now in the president’s wild and ugly claims about criminals supposedly pouring across the southern border.

Mr. Trump has not been vindicated. He has been enabled to save face after a series of defeats in the lower courts and in the court of aroused public opinion. Though still on the books and still inflicting arbitrary harm on would-be entrants to the United States, as Justice Stephen G. Breyer noted in a thoughtful dissent, the Trump policy was forced to change; checks and balances did operate to that extent. “In this case, it was not the decision but the process that defined America and that gives me hope,” Neal Katyal, one of the principal litigators against the travel ban, said Tuesday. These days, hope itself is a kind of victory.

Read more: