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.