NATIONWIDE -- In a ruling split along ideological lines, the Supreme Court on Tuesday upheld President Donald Trump's travel ban from several mostly Muslim countries.

  • Supreme Court rules in favor of Trump's travel ban
  • Travel ban restricts travel from 7 countries -- 5 are mostly Muslim
  • Dissenting justices said ban shows 'anti-Muslim' bias
  • READ IT: Trump v. Hawaii full Supreme Court ruling (PDF)

The 5-4 decision is the court's first substantive ruling on a Trump administration policy.

Soon after the ruling was announced, Trump tweeted "Wow!"

Writing for the majority opinion and the four other conservative justices, Chief Justice John Roberts said presidents have substantial power to regulate immigration. They also rejected a challenge that the ban discriminated against Muslims.

The travel ban applies to people coming from seven countries, five with mostly Muslim populations: Iran, Libya, Somalia, Syria and Yemen. The two non-Muslim countries to which the ban applies are North Korea and some Venezuelan officials and their families.

Justice Sonia Sotomayor disagreed, writing for the dissenting justices that "a reasonable observer would conclude that the Proclamation was motivated by anti-Muslim animus." Justices Stephen Breyer, Ruth Bader Ginsburg and Elena Kagan also dissented.

"History has its eyes on us -- and will judge today’s decision harshly," the American Civil Liberties Union said of the Supreme Court's ruling.

The full policy took effect in December after the Supreme Court declined to block it. Lower courts had ruled it out of bounds. Federal trial judges in Hawaii and Maryland had blocked the ban from taking effect. The travel ban officially was Trump v. Hawaii. 

In his written opinion, Roberts was careful not to endorse Trump's statements about immigration and Muslims.

"We express no view on the soundness of the policy," Roberts wrote.