WASHINGTON — The U.S. Supreme Court on Tuesday handed Donald Trump one of the biggest victories of his presidency, upholding his travel ban targeting several Muslim-majority countries and rejecting the idea that it represented unconstitutional religious discrimination.
The 5-4 ruling, with the court’s five conservatives in the majority, ends a fierce fight in the courts over whether the policy represented an unlawful Muslim ban. Trump can now claim vindication after lower courts had blocked his travel ban announced in September, as well as two prior versions, in legal challenges brought by the state of Hawaii and others.
READ MORE: Donald Trump hosts ‘iftar’ evening meal for Muslim holy month of Ramadan
The court held that the challengers had failed to show that the ban violates either U.S. immigration law or the U.S. Constitution’s First Amendment prohibition on the government favoring one religion over another.
Trump, who has called the travel ban necessary to protect the country against attacks by Islamic militants, reacted on Twitter, writing: “Wow!”
In a statement issued by the White House, Trump labeled the ruling “a tremendous victory for the American People and the Constitution” that upheld presidential authority on national security issues.
WATCH: ‘Is America really a free country?’ Child effected by travel ban scolds SCOTUS over ruling
“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.
Writing for the court, Chief Justice John Roberts said that Trump’s administration “has set forth a sufficient national security justification” to prevail. “We express no view on the soundness of the policy,” Roberts added.
The ruling affirmed broad presidential discretion over who is allowed to enter the United States. It means that the current ban can remain in effect and that Trump could potentially add more countries.
The current ban, announced in September, prohibits entry into the United States of most people from Iran, Libya, Somalia, Syria and Yemen. The Supreme Court allowed it to go largely into effect in December while the legal challenge continued.
Roberts said the actions taken by Trump to suspend entry of certain classes of people were “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.”
The challengers have argued the policy was motivated by Trump’s enmity toward Muslims and urged courts to take into account his inflammatory comments during the 2016 presidential campaign. Trump as a candidate called for “a total and complete shutdown of Muslims entering the United States.”
In a strident dissent that she read from in court, liberal Justice Sonia Sotomayor said there were “stark parallels” with the court’s now discredited 1944 decision that upheld U.S. internment of Japanese-Americans during World War Two. Sotomayor described at length various statements Trump made on the campaign trail.
“Taking all the evidence together, a reasonable observer would conclude that the proclamation was driven primarily by anti-Muslim animus,” Sotomayor added.
As part of Tuesday’s ruling, Roberts officially repudiated the 1944 internment ruling and he rejected the comparison, saying that the war-era practice was “objectively unlawful and outside the scope of presidential authority.”
WATCH: Trump says travel ban ruling ‘tremendous victory’ for the U.S.
Roberts said it was “wholly inapt to liken that morally repugnant order to a facial neutral policy denying certain foreign nationals the privilege of admission.”
The travel ban was one of Trump’s signature hardline immigration policies that have been a central part of his presidency and “America First” approach. Trump issued his first version just a week after taking office, though it was quickly halted by the courts.
READ MORE: Toronto-based Syrian children’s choir turns down festival over fears of crossing U.S. border
Chad initially was on the list of countries targeted by Trump that was announced in September, but he removed it on April 10. Iraq and Sudan were on earlier versions of the ban. Venezuela and North Korea also were targeted in the current policy. Those restrictions were not challenged in court.
Civil rights groups and Democrats denounced the ruling.
“The ruling will go down in history as one of the Supreme Court’s great failures,” said Omar Jadwat, a lawyer for the American Civil Liberties Union, which challenged the ban.
The court’s decision “swallows wholesale government lawyers’ flimsy national security excuse for the ban instead of taking seriously the president’s own explanation for his actions,” Jadwat added.
“Not since key decisions on slavery, segregation in schools, and Japanese American incarceration have we seen a decision that so clearly fails to protect those most vulnerable to government-led discrimination,” added Farhana Khera, executive director of the group Muslim Advocates.
WATCH: Trump says U.S. currently spending $1.6 billion on border wall
“Despite today’s ruling, turning away those fleeing horrific violence and persecution or to discriminate against people based on nationality and religion continues to be as un-American as ever,” said Senator Bob Menendez, the top Democrat on the Senate Foreign Relations Committee.
Trump also has moved to rescind protections for young immigrants sometimes called Dreamers brought into the United States illegally as children, acted against states and cities that protect illegal immigrants, ended protected status for certain immigrants in the country for decades, intensified deportation efforts and pursued limits on legal immigration.
Trump last week retreated on his administration’s practice of separating the children of immigrants from their parents when families were detained illegally entering the United States.
The high court in June and December 2017 allowed two versions of the ban to take effect while court challenges ran their course but had not resolved the legal merits of the challenges until now.
His lawyers said that only Trump’s actions since he became president in January 2017 should be relevant to the case. During the April 25 arguments before the justices, Solicitor General Noel Francisco said it was “crystal clear” that the travel restrictions were not a manifestation of Trump’s call for a Muslim ban.