On Tuesday, the Supreme Court affirmed and expanded the president’s power to exclude entire classes of immigrants from the country. Its 5–4 decision in Trump v. Hawaii is a historic triumph for Donald Trump and a crushing blow to immigration activists, who had hoped the courts might rein in the president’s sweeping order. Justice Neil Gorsuch, Trump’s appointee to the court, cast the decisive fifth vote to uphold the ban. While Chief Justice John Roberts’ opinion for the court strives to rise above politics, Hawaii will almost certainly be remembered as a deeply partisan opinion in which five Republican appointees willfully ignored the flagrant bigotry of a Republican president.

The executive order at issue bars citizens of five Muslim-majority countries, as well as certain individuals from North Korea and Venezuela, from entering the United States. It is the third iteration of Trump’s travel ban; the first was struck down in the lower courts, and the second was modified by the courts, then replaced with the current, permanent version. Opponents of the current ban argue that it violates the First Amendment’s Establishment Clause by disfavoring Islam, citing Trump’s bigoted comments about Muslims, as well as the order’s focus on Muslim-majority countries. They also alleged that it exceeds Trump’s power under the Immigration and Nationality Act, which restricts the president’s ability to “suspend the entry of … any class of aliens” and bars discrimination in the “issuance of an immigrant visa” on the basis of nationality.

But Roberts waved away both arguments. First, he noted that the INA does allow the president to suspend a class of aliens when he finds their entry “would be detrimental to the interests of the United States.” Trump, Roberts wrote, had “undoubtedly fulfilled that requirement here” by ordering the Department of Homeland Security to review “every single country’s compliance with the information and risk assessment baseline.” Through that evaluation, Trump met the INA’s requirements. Moreover, Roberts found that the travel ban does not discriminate on the basis of nationality in “the issuance of immigrant visas” because the INA still allows the president to “suspend entry” of particular immigrants outside of the visa process. Put differently, an individual may obtain a valid visa to the U.S. but still be denied entry on other grounds. The travel ban now constitutes one of those other grounds.

Second, Roberts wrote that the travel ban does not violate the Establishment Clause because the ban is neutral on its face. Although Trump declared publicly that he wanted to ban Muslims from entering the U.S., the text of the order does not express animus toward Muslims, Roberts explained. And when the president provides a “facially legitimate and bona fide” reason for some foreign policy—particularly in “the area of national security”—the courts may not look for some illicit motive. As a result, the courts are obligated to accept Trump’s neutral explanations for the ban. Any other rule, Roberts insisted, would “inhibit the flexibility” of the president “to respond to changing world conditions.”

Justice Sonia Sotomayor, in a dissent joined by Justice Ruth Bader Ginsburg, fiercely contested the court’s Establishment Clause holding. Sotomayor cited a litany of Trump’s anti-Muslim comments, noting that the travel ban was first advertised “openly and unequivocally as a ‘total and complete shutdown of Muslims entering the United States.’ ” Trump, Sotomayor noted, “has never disavowed any of his prior statements about Islam,” and instead “has continued to make remarks that a reasonable observer would view as an unrelenting attack on the Muslim religion and its followers.” She wrote that the court has a responsibility to look beyond Trump’s pretextual justifications for the ban to acknowledge the obvious: It is “motivated by animosity toward a disfavored group.”

In a separate dissent, Justice Stephen Breyer, joined by Elena Kagan, agreed that the ban was likely motivated by “antireligious bias.” He added that the ban’s waiver process is, as Slate has reported, an absolute sham, mere “window dressing” to make the order seem legitimate. He would therefore strike down the ban in its entirety.

There is one silver lining to Tuesday’s ruling. Sotomayor accused Roberts of perpetuating Korematsu, in which the Supreme Court upheld Japanese internment during World War II. In response, Roberts formally overturned that decision, writing that it “has no place in law under the Constitution.” Yet in the process, he upheld an order that evokes Korematsu in its eagerness to ignore the obviously bigoted motivations behind a president’s putative foreign policy determinations. Roberts presumably wants credit for reversing one of the darkest chapters in the court’s history. Yet his decision on Tuesday entirely fails to heed the lessons of that odious precedent.