Updated at 2:33 p.m. ET
In a 5-4 ruling that gave broad leeway to presidential authority, the U.S. Supreme Court upheld President Trump's travel ban that barred nearly all travelers from five mainly Muslim countries.
The president's proclamation was "squarely within the scope of Presidential authority under the INA,'" the court wrote in its majority opinion, referring to the Immigration and Nationality Act.
"Today's Supreme Court ruling is a tremendous victory for the American People and the Constitution," Trump said in a statement. "The Supreme Court has upheld the clear authority of the President to defend the national security of the United States. In this era of worldwide terrorism and extremist movements bent on harming innocent civilians, we must properly vet those coming into our country.
"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."
The court seemed to tip its hand at oral arguments in April, when a majority of the justices appeared ready to side with Trump. The court was ruling on what was the third version of the ban, which Trump has complained is a "watered-down" version.
The court allowed it to go into effect while the case was being litigated, but the lower courts had ruled that all three versions either violate federal law or are unconstitutional.
Like the earlier two bans, Version 3.0 bars almost all travelers from five mainly Muslim countries — Iran, Iraq, Syria, Yemen and Libya — and it adds a ban on travelers from North Korea and government officials from Venezuela.
The court acceded broadly to presidential power. The majority opinion, written by Chief Justice John Roberts, noted that the INA exudes deference to the president. The executive order, he wrote, was more detailed than similar orders by Presidents Ronald Reagan and Jimmy Carter and defers to the president's power.
The only thing a president has to signal is that entry for people from various countries would be detrimental to the interest of the United States. The president undoubtedly fulfilled that requirement here, the court noted.
The president, Roberts said, has extraordinary power to express his opinions to the country, as well. The plaintiffs argue that Trump's past campaign and other statements about Muslims should be taken into account, but the majority said it is not the court's role to do that.
He added that the order was neutral on its face and that the president was addressing a matter within the core of executive responsibility. Roberts signaled that the court was balancing not just statements of the president, but the authority of the presidency.
Justices Stephen Breyer and Sonia Sotomayor both made the relatively rare decision to read their dissents from the bench.
Speaking with unusual passion, Sotomayor said that the court's reasoning "fails to safeguard fundamental principles" embedded in the First Amendment. She excoriated the majority's "apparent willingness to throw" parts of the First Amendment "out the window," and to forego "any meaningful constitutional review at the mere mention of a national-security concern."
While the court has a duty to be deferential to the president, she said, "deference is different from unquestioning acceptance." She then read a selection of anti-Muslim statements made by the president, admonishing the audience to "take a brief moment to let that sink in."
Comparing Tuesday's outcome to the court's decision, in 1944, to uphold the legality of Japanese-American internment camps, Sotomayor accused the court of repeating "tragic mistakes of the past." Upholding the travel ban, she said turns "a blind eye to the pain and suffering" that it "inflicts upon countless families and individuals, many of whom are United States citizens."
"History will not look kindly on the court's decision today," she concluded, "nor should it."
Outside reaction to the ruling was swift.
"This ruling will go down in history as one of the Supreme Court's great failures," said Omar Jadwat, director of the ACLU's Immigrants' Rights Project, in a statement. "It repeats the mistakes of the Korematsu decision upholding Japanese-American imprisonment and swallows wholesale government lawyers' flimsy national security excuse for the ban instead of taking seriously the president's own explanation for his actions.
House Democratic leader Nancy Pelosi slammed the decision in a statement, saying, "The court failed today, and so the public is needed more than ever" to challenge officials who do not move to rescind the ban.
Pelosi added that the ban will actually backfire and serve a "recruiting tool" for terrorists and invoked other recent controversial foreign policy moves by Trump.
"The President's disdain for our values and the safety of the American people has led him to undermine relationships with critical allies, embrace autocrats and dictators, launch damaging trade wars and sow fear in our communities with his hateful, ugly language," she said. "Whether tearing children from their parents at the border or advancing a ban founded on open bigotry, President Trump is making our nation less safe at home and less respected abroad."
NPR's Annie Hollister contributed to this report.