WASHINGTON (CN) – As the Supreme Court upheld President Donald Trump’s so-called travel ban 5-4 Tuesday, Justice Sonia Sotomayor skewered the majority for turning a blind eye to what she called clear discrimination against Muslims.

“History will not look kindly upon the court’s misguided decision today, nor should it,” Sotomayor said while reading her dissent from the bench.

The censure did not appear to goad Chief Justice John Roberts, the author of the majority opinion Tuesday. Though stoic as Sotomayor spoke, Roberts occasionally glanced up at the courtroom’s painted ceiling and carved statues. In his ruling, the chief justice called it clear under the Immigration and Nationality Act that the president is authorized to restrict the entry of aliens whenever he finds that their entry “would be detrimental to the interests of the United States.”

“The president has undoubtedly fulfilled that requirement here,” Roberts added.

Sotomayor meanwhile painted the reversal as an unwelcome echo of Korematsu v. United States, a 1944 decision in which the Supreme Court endorsed the World War II-era executive order that forced Japanese-Americans into internment camps.

“As here, the government invoked an ill-defined national-security threat to justify an exclusionary policy of sweeping proportion,” she wrote. “As here, the exclusion order was rooted in dangerous stereotypes about, inter alia, a particular group’s supposed inability to assimilate and desire to harm the United States. As here, the government was unwilling to reveal its own intelligence agencies’ views of the alleged security concerns to the very citizens it purported to protect. And as here, there was strong evidence that impermissible hostility and animus motivated the government’s policy.”

But Chief Justice Roberts waved off the parallels as strained.

“Whatever rhetorical advantage the dissent may see in doing so, Korematsu has nothing to do with this case,” he wrote. “The forcible relocation of U.S. citizens to concentration camps, solely and explicitly on the basis of race, is objectively unlawful and outside the scope of presidential authority. But it is wholly inapt to liken that morally repugnant order to a facially neutral policy denying certain foreign nationals the privilege of admission. The entry suspension is an act that is well within executive authority and could have been taken by any other president — the only question is evaluating the actions of this particular president in promulgating an otherwise valid proclamation.”

Sotomayor by contrast accused the majority of dishonoring the principle of religious neutrality in the First Amendment.

“It leaves undisturbed a policy first advertised openly and unequivocally as a ‘total and complete shutdown of Muslims entering the United States’ because the policy now masquerades behind a façade of national-security concerns,” she wrote. “But this repackaging does little to cleanse Presidential Proclamation No. 9645 of the appearance of discrimination that the president’s words have created. Based on the evidence in the record, a reasonable observer would conclude that the proclamation was motivated by anti-Muslim animus. That alone suffices to show that plaintiffs are likely to succeed on the merits of their establishment clause claim. The majority holds otherwise by ignoring the facts, misconstruing our legal precedent, and turning a blind eye to the pain and suffering the proclamation inflicts upon countless families and individuals, many of whom are United States citizens.”

Roberts devoted about a third of his decision to the claim that the travel ban unconstitutionally targets Muslims.

“The proclamation is expressly premised on legitimate purposes: preventing entry of nationals who cannot be adequately vetted and inducing other nations to improve their practices,” the 39-page ruling states. “The text says nothing about religion. Plaintiffs and the dissent nonetheless emphasize that five of the seven nations currently included in the proclamation have Muslim-majority populations. Yet that fact alone does not support an inference of religious hostility, given that the policy covers just 8% of the world’s Muslim population and is limited to countries that were previously designated by Congress or prior administrations as posing national security risks.”

Darakshin Rhia, co-director of the Justice for Muslims Collective, said in an interview outside the courthouse that that her group will keep pushing back against policies like the travel ban.

“It’s a heavy day for us, because, again, this ban in its implementation was definitely targeted at the Muslim community, it is definitely discriminatory, and yet the court is saying in its opinion that it’s not, that it’s justified under the name of national security,” Rhia said. “But we have to question whose backs are these national-security policies being built on and is it fair when our rights are being, sort of, taken away from us?”

Rhia took little solace in Sotomayor’s strong dissent, saying the majority’s holding will have the most profound impact.

Concurring with Roberts were Justices Anthony Kennedy, Clarence Thomas, Samuel Alito and Neil Gorsuch. While Justice Ruth Bader Ginsburg joined Sotomayor’s 27-page dissent, Justice Elena Kagan joined an 8-page dissent by Justice Stephen Breyer.

“How could the government successfully claim that the proclamation rests on security needs if it is excluding Muslims who satisfy the proclamation’s own terms?” Breyer wrote. “At the same time, denying visas to Muslims who meet the proclamation’s own security terms would support the view that the government excludes them for reasons based upon their religion.”

Breyer also cited the mountain of evidence that the proclamation may be written constitutionally but not applied that way.

“The proclamation does not apply to asylum seekers or refugees,” Breyer wrote. “Yet few refugees have been admitted since the proclamation took effect. While more than 15,000 Syrian refugees arrived in the United States in 2016, only 13 have arrived since January 2018. Similarly few refugees have been admitted since January from Iran (3), Libya (1), Yemen (0), and Somalia (122).”

Likewise the United States has seen just 258 student visas issued to applicants from the targeted countries.

“This is less than a quarter of the volume needed to be on track for 2016 student visa levels,” Breyer wrote. “And only 40 nonimmigrant visas have been issued to Somali nationals, a decrease of 65 percent from 2016. While this is but a piece of the picture, it does not provide grounds for confidence.”

President Donald Trump praised the decision in a statement through the White House, calling it a “tremendous victory for the American people and the Constitution.”

“In this era of worldwide terrorism and extremist movements bent on harming innocent civilians, we must properly vet those coming into our country,” Trump said. “This ruling is also 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. As long as I am president, I will defend the sovereignty, safety and security of the American people and fight for an immigration system that serves the national interests of the United States and its citizens. Our country will always be safe, secure and protected on my watch.”

Roberts called it fatal to the travel-ban challenge that their argument rests on the theory that the law requires the president both to make finding about detrimental entry and “to explain that finding with sufficient detail to enable judicial review.”

“But even assuming that some form of review is appropriate, plaintiffs’ attacks on the sufficiency of the president’s findings cannot be sustained,” the ruling states. “The 12-page proclamation — which thoroughly describes the process, agency evaluations, and recommendations underlying the president’s chosen restrictions — is more detailed than any prior order a president has issued under §1182(f).”

The majority was similarly dismissive of claims that the travel ban evolved from nationality-based discrimination.

“Presidents have repeatedly exercised their authority to suspend entry on the basis of nationality,” Roberts wrote, pointing out that President Ronald Reagan also relied on the Immigration and Nationality Act to suspend entry “as immigrants by all Cuban nationals,” subject to exceptions.

The version of the travel ban the court considered is the third the Trump administration has produced, with its first on Jan. 27, 2017, instituting a 90-day block against anyone from seven countries with Muslim majorities from entering the United States.

A revised version on March 6 blocked for 90 days the entry of certain people from six Muslim-majority countries. Last year the Ninth and Fourth Circuits upheld federal injunctions against Version 2 from judges in Hawaii and Maryland.

Still the order expired before the Supreme Court could weigh in, and Trump signed a third version of the order on Sept. 24, 2017. The latest version applies to five countries with Muslim majorities but also prevents anyone from Iran, North Korea or Syria from entering the country, with limited exceptions for Iran. Initially the order suspended immigrant visas from Chad, Libya and Yemen, but Chad has since won its way off the list, with the White House pointing to improvements in the country’s vetting process.

Travelers from Somalia also face additional requirements in obtaining a U.S. visa, and the order bars Venezuelan government officials and their immediate family members from entering the United States.

The Supreme Court heard oral arguments in April after the Ninth Circuit affirmed an injunction awarded to the state of Hawaii, the Muslim Association of Hawaii and three individual challengers.

In a concurring opinion Tuesday, Thomas cast doubt on whether federal district courts, such as those in which the case originated, have authority to grant injunctions that apply across the country. Noting the practice is a fairly recent development, Thomas wrote nationwide injunctions go against the limited powers the framers granted the judiciary.

“I am skeptical that district courts have the authority to enter universal injunctions,” Thomas wrote, joined by Gorsuch. “These injunctions did not emerge until a century and a half after the founding. And they appear to be inconsistent with longstanding limits on equitable relief and the power of Article III courts. If their popularity continues, this court must address their legality.”

U.S. Solicitor General Noel Francisco cast the latest order as the result of an intensive review of foreign vetting procedures with a legitimate national-security purpose, but Hogan Lovells partner Neal Katyal told the justices that a reversal would grant unprecedented authority to the president to determine who can and cannot enter the country.

As for Trump’s call during the campaign for a ban on Muslims entering the United States, Francisco had said such comments should not matter because Trump was a private citizen at the time.

Omar Jadwat, the director of the ACLU’s Immigrants’ Rights Project, told reporters in a press call that “flimsy” justifications by the Trump administration somehow overcame an “unparalleled record” of discriminatory intent.

In a nod to Sotomayor’s dissent, Jadwat called the decision Tuesday difficult to square with precedent in other cases involving religious liberty.

“This court that has been exquisitely sensitive to religious freedom and the requirement of religious neutrality in other contexts fell down on the job today,” Jadwat said.

Mohamad Mashta, who was a plaintiff in an earlier challenge to the order, said on the press call the ruling has made him and his family feel like “second-class people.” He also worried the ruling would give the administration room to take more aggressive actions.

“If they are allowed to have this ban, what will they try next?” Mashta asked.

Though Roberts disagreed with Sotomayor’s references to Korematsu, he said the topic offered the court an “opportunity to make express what is already obvious.”

“Korematsu was gravely wrong the day it was decided, has been overruled in the court of history, and — to be clear — ‘has no place in law under the Constitution,’” the final pages of the lead decision state.

Sotomayor called this “formal repudiation of a shameful precedent … laudable and long overdue.”

“But it does not make the majority’s decision here acceptable or right,” she added. “By blindly accepting the government’s misguided invitation to sanction a discriminatory policy motivated by animosity toward a disfavored group, all in the name of a superficial claim of national security, the court redeploys the same dangerous logic underlying Korematsu and merely replaces one ‘gravely wrong’ decision with another.

“Our Constitution demands, and our country deserves, a judiciary willing to hold the coordinate branches to account when they defy our most sacred legal commitments,” Sotomayor’s dissent concludes. “Because the court’s decision today has failed in that respect, with profound regret, I dissent.”

Back in 2015 on the campaign trail, Trump actually pointed to America’s internment of Japanese-Americans as justification for what he termed at the time as a “Muslim ban.”