Supreme Court upholds Trump's travel ban The travel ban in one the most highly anticipated cases of the year.

The Supreme Court has upheld President Donald Trump's travel ban in one of the most highly anticipated decisions of this year, saying the ban is "squarely within" the president's authority.

The Court's 5-4 ruling that the third iteration of Trump's controversial proposal, Travel Ban 3.0, is constitutional comes after two previous attempts by the administration to bar immigration to the United States from certain foreign countries.

President Trump reacted quickly, tweeting "SUPREME COURT UPHOLDS TRUMP TRAVEL BAN. Wow!"

SUPREME COURT UPHOLDS TRUMP TRAVEL BAN. Wow!

— Donald J. Trump (@realDonaldTrump) June 26, 2018

That newest iteration of the travel ban is a presidential proclamation signed on Sept. 24, 2017, that indefinitely restricted most travel from the countries of Chad, Iran, Iraq, Libya, North Korea, Syria, Venezuela, and Yemen -linking the restrictions to those countries' purported vetting deficiencies. In April, The U.S. lifted travel restrictions on Chad.

Some of those countries have a majority-Muslim population, leading to accusations that the administration was unfairly targeting Muslims. Federal judges in Maryland and Hawaii issued injunctions shortly afterward that blocked the ban for the majority-Muslim countries but allowed restrictions from North Korea and Venezuela to go into effect.

Trump said in a statement the ruling is a "tremendous victory" for the American people.

"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," he said in the statement.

"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."

In the case, Trump v. Hawaii, the state of Hawaii argues that the ban hurts its university system by banning potential students and scholars from entering the country. Individual plaintiffs who joined the case with Hawaii also say it separates them from family members who applied for visas to enter the country.

The administration argued that Travel Ban 3.0 was vetted by multiple agencies and was based on a review of foreign policy, not religion. Hawaii and the other plaintiffs challenged the proclamation, asking the court to rule on whether it was a lawful use of the president's authority, was too broad, or improperly targeted countries with a large Muslim population.

The court ruled in favor of the administration, Chief Justice John Roberts writing "..the Government has set forth a sufficient national security justification to survive rational basis review. We express no view on the soundness of the policy. We simply hold today that plaintiffs have not demonstrated a likelihood of success on the merits of their constitutional claim."

"The proclamation is squarely within the scope of Presidential authority under the INA," Roberts wrote in the court's decision, also saying that neither dissent "even attempts a serious argument to the contrary." INA is an acronym for the Immigration and Nationality Act.

In response to arguments that the travel ban targeted Muslims, citing President Trump's previous comments about Muslims and Islam, the plaintiffs argued that Trump's rhetoric contradicted America's constitutional tradition, but Roberts said the proclamation itself is neutral toward religion.

"The Proclamation is expressly premised on legitimate purposes: preventing entry of nationals who cannot be adequately vetted and inducing other nations to improve their practices. The text says nothing about religion," Roberts said. "Plaintiffs and the dissent nonetheless emphasize that five of the seven nations currently included in the Proclamation have Muslim-majority populations. Yet that fact alone does not support an inference of religious hostility, given that the policy covers just 8% of the world's Muslim population."

Justice Sonia Sotomayor, joined by Justice Ruth Bader Ginsburg, said in her dissent that the majority decision fails to protect religious liberty as a fundamental American principle. The dissent chronicles many of Trump's previous comments about Muslims during the campaign and references that the travel ban was originally advertised as a "total and complete shutdown of Muslims entering the United States."

"This repackaging does little to cleanse Presidential Proclamation No. 9645 of the appearance of discrimination that the President's words have created. Based on the evidence in the record, a reasonable observer would conclude that the Proclamation was motivated by anti-Muslim animus," Sotomayor said.

Attorney General Jeff Sessions said the decision is a "great victory for the safety and security of all Americans."

"The Constitution and Acts of Congress confer on the President broad discretion to protect the interests of the United States. Today’s decision is critical to ensuring the continued authority of President Trump – and all future presidents – to protect the American people. We will continue to take and defend all lawful steps necessary to protect this great nation," he said in a statement.

The Department of Homeland Security also said that the ruling confirms the legality of Trump's executive actions to protect Americans from terrorists and malicious actors that abuse the immigration system.

The American Civil Liberties Union said the decision will "go down in history as one of the Supreme Court's greatest failures."

"It is ultimately the people of this country who will determine its character and future. The court failed today, and so the public is needed more than ever. We must make it crystal clear to our elected representatives: If you are not taking action to rescind and dismantle Trump’s Muslim ban, you are not upholding this country’s most basic principles of freedom and equality," director of the ACLU Immigrants' Rights Project Omar Jadwat said in a statement.

Two previous attempts by the Trump administration to restrict immigration from majority-Muslim countries have been struck down by federal courts.

A week after his inauguration, Trump issued an executive order to immediately suspend admission into the country by individuals from seven Muslim-majority countries: Iran, Iraq, Syria, Yemen, Libya, Somalia, and Sudan for 90 days. It also halted refugee admissions for 120 days and indefinitely banned Syrian refugees. The order contained an exception for members of religious minorities.

Jim Watson/AFP/Getty Images

Inflamed by the administration's attempt to restrict immigration from predominantly Muslim countries, protesters descended on the nation's airports and chaos swiftly ensued. The Ninth Circuit rejected the first so-called travel ban, and the administration subsequently introduced a slightly altered order. Travel Ban 2.0 also faced challenges in a number of lower courts, but in June 2017 the Supreme Court allowed it to go partially into effect. The order expired by its own terms and the Trump administration replaced it with the proclamation upheld Tuesday.

The addition of Chad -- a key counterterror ally which has been cooperating with the U.S. against ISIS, Boko Haram, and others -- was seen by many foreign policy experts as a grave error. Since then, the White House said H.R. McMaster, the then-national security adviser, had spoken to Chad's president, Idriss Deby Itno, about how to work together "to address the deficiencies, toward the goal of improving vetting capabilities and lifting visa restrictions."

ABC News' Supreme Court contributor Kate Shaw contributed to this report.