The action Monday is a victory for President Donald Trump in the biggest legal controversy of his young presidency.
The court is allowing the ban to go into effect for foreign nationals who lack any "bona fide relationship with any person or entity in the United States." The court, in an unsigned opinion, left the travel ban against citizens of six majority-Muslim on hold as applied to non-citizens with relationships with persons or entities in the United States, which includes most of the plaintiffs in both cases.
Examples of formal relationships include students accepted to US universities and an employee who has accepted a job with a company in the US, the court said.
The Connecticut Council Of Islamic-American Relations, C.A.I.R., issued a travel alert. C.A.I.R. says citizens of the countries listed in the travel ban should consult with an attorney before traveling. C.A.I.R. says it's also working with the Connecticut ACLU to organize a town hall event on the ban.
This is the first time the high court has weighed in on the travel ban, and a partial victory for the Trump administration, which has been fighting lower court rulings blocking the ban from taking effect. Justices did not address Trump's tweets which have caused legal problems for his administration previously.
The ban applies to citizens of Iran, Libya, Somalia, Sudan, Syria and Yemen. It would bar them from entering the US for 90 days -- outside of the "bona fide" relationship exception -- could take effect in as little as 72 hours.
Trump called the decision "a clear victory for our national security."
"As President, I cannot allow people into our country who want to do us harm," he added in a statement. "I want people who can love the United States and all of its citizens, and who will be hardworking and productive."
How officials implement the ban could cause chaos at airports, similar to what happened when Trump's first travel ban executive order was written in January (it was later blocked).
"That's going to be an extreme headache. Think about how the people at the border, at airports are going to make that decision," said Page Pate, CNN legal analyst. "Who is going to make this decision? If we leave it to the folks on the front line, that's just going to lead to more litigation."
Trump signed a memorandum earlier this month which states that administration officials shall begin implementation of the parts of the order that are allowed to go forward 72 hours after the court rules.
The Department of Homeland Security said in a statement it will discuss the court's action with the Justice and State departments and said it would implement the ban "professionally, with clear and sufficient public notice, particularly to potentially affected travelers, and in coordination with partners in the travel industry."
As for refugees, the court held that a person seeking refuge in the US can claim "concrete hardship" -- but in the end, if they "lack any such connection to the United States ... the balance tips in favor of the government's compelling need to provide for the Nation's security."
Sidesteps Trump's tweets
Trump himself has repeatedly criticized judges who sided against the travel ban and suggested the judicial system is against him and harming national security interests.
"The courts are slow and political!" Trump wrote in one of several tweets criticizing rulings from various federal judges this year.
"That's right, we need a TRAVEL BAN for certain DANGEROUS countries, not some politically correct term that won't help us protect our people," Trump tweeted earlier this month.
This is Trump's second attempt to install a travel ban.
The first executive order was issued one week into his term, and sought to bar people from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen from entering the US for 90 days and all refugees for 120 days.
After it was blocked by the courts, Trump tried again in March with a revised version that didn't include Iraq and was meant to clarify problems of the first order that created uncertainty about the rights of dual citizens and holders of US visas. It had been blocked by courts on both constitutional and statutory grounds.
Trump has called his second executive order "watered down," and "politically correct."
But while lower courts used Trump's own words against the White House as a justification to stop the ban from taking effect, the high court did not look at that language.
Candidate Trump issued a statement calling for the "total and complete shutdown" of Muslims entering the United States until the government could "figure out what is going on," in response to a deadly mass shooting in San Bernardino, California, by ISIS sympathizers in December 2015.
"The 16 pages did not include any citations to President Trump's campaign rhetoric," said CNN senior legal analyst Jeffrey Toobin. "And the Supreme Court seems reluctant to get into the business of that, which is why I always thought the President had the best chance of winning at the Supreme Court."
"This is about the executive order itself. It is not about the campaign or anything else," Toobin added.
Conservative trio would have allowed full ban
Justice Clarence Thomas dissented with Justice Samuel Alito and newly-appointed Justice Neil Gorsuch, saying the court didn't go far enough.
Thomas said he would have stayed the injunctions "in full," adding the government is "likely to succeed on the merits."
Thomas expressed concern with the "court's remedy" and said he fears it will "prove unworkable."
"Today's compromise will burden executive officials with the task of deciding -- on peril of contempt -- whether individuals from the six affected nations who wish to enter the United States have a sufficient connection to a person or entity in this country," he said.
Chief Justice John Roberts and Justice Anthony Kennedy -- who has been considering retirement -- both joined the majority opinion that agreed to keep parts of the ban on hold until oral arguments this fall.
That fact is telling, said Steve Vladeck, CNN legal analyst and professor at the University of Texas School of Law "The fact that neither agreed with the dissenters to put the full Executive Order into effect may be an important signal for how they'd be likely to rule on the merits -- and a bad sign for the Trump administration at least with respect to no -- citizens with connections to the United States," Vladeck said.
Toobin also suggested how the court handled the case means Kennedy will stick around.
"The fact that Kennedy didn't retire today probably means he won't retire this term," Toobin said. "However, Sandra Day O'Connor did retire two days after the term ended."