The US Supreme Court has upheld Donald Trump's ban on travel from several mostly Muslim countries - rejecting a challenge that it discriminated against Muslims or exceeded the president's authority.
The 5-4 decision is the court's first substantive ruling on a Trump administration policy.
Mr Trump responded to the decision with a "Wow!" on Twitter.
Chief Justice John Roberts wrote the majority opinion, joined by his four conservative colleagues. He wrote that presidents have substantial power to regulate immigration. He also rejected the challengers' claim of anti-Muslim bias.
But the judge was careful not to endorse Mr Trump's provocative statements about immigration in general and Muslims in particular.
"We express no view on the soundness of the policy," Chief Justice Roberts wrote.
The travel ban has been fully in place since the court declined to block it in December. The justices allowed the policy to take full effect even as the court fight continued and lower courts had ruled it out of bounds.
Justice Sonia Sotomayor wrote in a dissent that based on the evidence in the case "a reasonable observer would conclude that the Proclamation was motivated by anti-Muslim animus".
She said her colleagues arrived at the opposite result 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".
Justices Stephen Breyer, Ruth Bader Ginsburg and Elena Kagan also dissented.
The policy applies to travellers from five countries with overwhelmingly Muslim populations: Iran, Libya, Somalia, Syria and Yemen.
It also affects two non-Muslim countries: blocking travellers from North Korea and some Venezuelan government officials and their families. A sixth majority Muslim country, Chad, was removed from the list in April after improving "its identity-management and information sharing practices", Mr Trump said in a proclamation.