Trump cheers travel ban win before Supreme Court: 'Wow!'

President Trump cheered the Supreme Court’s decision Tuesday to uphold the administration’s controversial travel ban affecting several mostly Muslim countries, following the ruling on one of the hardest-fought legal battles of his term.

“SUPREME COURT UPHOLDS TRUMP TRAVEL BAN. Wow!” Trump tweeted minutes after the court’s decision was made public.

The 5-4 ruling marks the first major high court decision on a Trump administration policy. The decision upholds the selective travel restrictions, which critics called a discriminatory “Muslim ban” but the administration argued were needed for security reasons.

At issue was whether the third and latest version of the administration’s policy affecting visitors from five Muslim majority nations—known as travel ban 3.0—discriminates on the basis of nationality and religion in issuing immigrant visas.

Chief Justice John Roberts, who authored the conservative majority opinion, wrote that the order was “squarely within the scope of Presidential authority” under federal law.

The court’s decision offered a narrow endorsement of the president’s executive authority on immigration.

While the policy was upheld, the justices sent the case back to the lower courts, which were told to rely on the Supreme Court’s interpretation of executive authority.

The White House released an official statement from the president calling the decision a "tremendous victory."

"Today's Supreme Court ruling is a tremendous victory for the American People and the Constitution. The Supreme Court has upheld the clear authority of the President to defend the national security of the United States," Trump said in the official statement. "In this era of worldwide terrorism and extremist movements bent on harming innocent civilians, we must properly vet those coming into our country."

The president also said that the ruling was a "moment of profound vindication" after months of "hysterical commentary from the media and Democratic politicians."

"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," Trump said. "Our country will always be safe, secure and protected on my watch."

The countries affected in Travel Ban 3.0 involved mostly Muslim populations: Iran, Libya, Sudan, Syria and Yemen. Chad was recently removed from the list after the administration said that country had beefed up its information sharing.

A lawyer fighting the policy, Neal Katyal, said in a statement that “the final chapter has not yet been written.”

“The president would be mistaken to interpret today’s decision as a greenlight to continue his unwise and un-American policies,” Katyal said in a statement to Fox News Tuesday. “As the Supreme Court has repeatedly said, not everything that is constitutional is good policy. The travel ban is atrocious policy, and makes us less safe and undermines our American ideals.”

He added: “Now that the Court has upheld it, it is up to Congress to do its job and reverse President Trump’s unilateral and unwise travel ban.”

Fox News' Bill Mears and The Associated Press contributed to this report.