In the 5-4 opinion written by Chief Justice John Roberts, the court found that Trump's travel restriction fell "squarely" within the president's authority. The court rejected claims that the ban was motivated by religious hostility.
"The [order] is expressly premised on legitimate purposes: preventing entry of nationals who cannot be adequately vetted and inducing other nations to improve their practices," Roberts wrote. "The text says nothing about religion."
The case, Trump v. Hawaii, has been central to the administration's travel policy, presenting a key test of the president's campaign promise to restrict immigration and secure America's borders.
Trump, who issued the ban in September, hailed the ruling in the case.
The travel restriction, the administration's third, affects people from Iran, Libya, North Korea, Somalia, Syria, Venezuela, and Yemen. Chad was dropped from the list of affected countries in April.
Previous versions of the ban were revised after facing challenges in court.
"Though I am disappointed by the outcome, I am heartened that our system of government worked as the founders intended," Neal Katyal, attorney for the challengers, said in a statement. "Now that the Court has upheld it, it is up to Congress to do its job and reverse President Trump’s unilateral and unwise travel ban."
After his tweet, the president said in a statement that the ruling was a "profound vindication" after "months of hysterical commentary from the media and Democratic politicians who refuse to do what it takes to secure our border and our country."
"Our country will always be safe, secure, and protected on my watch," Trump said.
The ruling broke down largely on partisan lines. Roberts and the four justices concurring with him — Anthony Kennedy, Clarence Thomas, Samuel Alito and Neil Gorsuch — were appointed by Republican presidents. The dissenting justices — Stephen Breyer, Elena Kagan, Sonia Sotomayor and Ruth Bader Ginsburg — were appointed by Democrats.
“The Supreme Court’s decision today was unsurprising," said Stephen Yale-Loehr, the co-author of a 21-volume book on U.S. immigration law. Yale-Loehr signed onto an amicus brief on behalf of Hawaii.
"Because immigration touches on national sovereignty and foreign relations, courts have generally deferred to the president on immigration issues,” he said.
Trump tweets not the issue, court says
Hawaii alleged that the restriction was motivated by religious discrimination, noting that a majority of the countries included in the ban have primarily Muslim populations. The case began in November, when Trump's solicitor general asked the Supreme Court to stay a ruling from a federal judge in Hawaii who blocked the ban. In response to the administration's move, Hawaii argued that the travel ban would cause families of Hawaiian residents to be separated, harm the University of Hawaii and do damage to "the public as a whole inflicted by a radical departure from the status quo that had existed for decades."
The court sided with the government, which argued in April that the restriction "would be the most ineffective Muslim ban that one could possibly imagine."
Roberts agreed with that argument. Though the ban applies to five countries with Muslim majority populations, "that fact alone does not support an inference of religious hostility," Roberts wrote, noting that those five countries amount to only 8 percent of the world's Muslim population.
During oral arguments in April, Katyal cited Trump's postelection tweets about the issue, and argued that the travel restriction amounted to a "Muslim ban."
The court addressed those statements, writing that "the issue before us is not whether to denounce the statements."
"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," Roberts wrote. "In doing so, we must consider not only the statements of a particular President, but also the authority of the Presidency itself."
While the court upheld Trump's travel restriction, Roberts noted that the ruling did not reflect the court's judgment on the "soundness" of the policy.
Among the tweets that were at issue in the case is one from September in which the president wrote that the "travel ban into the United States should be far larger, tougher and more specific-but stupidly, that would not be politically correct!"
Katyal also cited Trump's retweeting of what Katyal called "virulent anti-Muslim videos" in November. The videos, whose authenticity has been challenged, had titles such as "Muslim migrant beats up Dutch boy on crutches!" and "Muslim Destroys a Statue of Virgin Mary!"
Roberts wrote that the president has "an extraordinary power to speak to his fellow citizens" and that presidents "have frequently used that power to espouse the principles of religious freedom and tolerance on which this Nation was founded."
The chief justice cited comments made by then-President George W. Bush at the Islamic Center of Washington shortly after the Sept. 11, 2001, attacks. Bush said at the time that the "face of terror is not the true faith of Islam," and said that the United States is "a great country because we share the same values of respect and dignity and human worth.”
American presidents have "performed unevenly in living up to those inspiring words," Roberts said.
Trump has said the ban is not about Islam.
"This is not about religion—this is about terror and keeping our country safe," he said in January 2017, after facing criticism over the first version of the order.
That initial order, signed a week after Trump's inauguration, led to days administrative chaos and protests at airports around the country. It banned entry of people from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen for 90 days and indefinitely halted resettlement of refugees from Syria's civil war.