The court said Monday the ban on visitors from Iran, Libya, Somalia, Sudan, Syria and Yemen could be enforced as long as they lack a “credible claim of a bona fide relationship with a person or entity in the United States.” The justices will hear arguments in the case in October.

Trump said last week that the ban would take effect 72 hours after being cleared by courts.

The Trump administration said the 90-day ban was needed to allow an internal review of the screening procedures for visa applicants from those countries. That review should be complete before Oct. 2, the first day the justices could hear arguments in their new term.

A 120-ban on refugees also is being allowed to take effect on a limited basis.

Three of the court’s conservative justices said they would have let the complete bans take effect.

Justice Clarence Thomas, joined by Justices Samuel Alito and Neil Gorsuch, said the government has shown it is likely to succeed on the merits of the case, and that it will suffer irreparable harm with any interference. Thomas said the government’s interest in preserving national security outweighs any hardship to people denied entry into the country.

Two federal appeals courts had blocked the travel policy, which Trump announced a week after he took office in January and revised in March after setbacks in court.

The 4th U.S. Circuit Court of Appeals in Richmond, Virginia, said the ban was “rooted in religious animus” toward Muslims and pointed to Trump’s campaign promise to impose a ban on Muslims entering the country as well as tweets and remarks he has made since becoming president.

The San Francisco-based 9th U.S. Circuit Court of Appeals said the travel policy does not comply with federal immigration law, including a prohibition on nationality-based discrimination. That court also put a hold on separate aspects of the policy that would keep all refugees out of the United States for 120 days and cut by more than half, from 110,000 to 50,000, the cap on refugees in the current government spending year that ends September 30.

Trump’s first executive order on travel applied to travelers from the six countries as well as Iraq, and took effect immediately, causing chaos and panic at airports over the last weekend in January as the Homeland Security Department scrambled to figure out who the order covered and how it was to be implemented.

A federal judge blocked it eight days later, an order that was upheld by a 9th circuit panel. Rather than pursue an appeal, the administration said it would revise the policy.

In March, Trump issued the narrower order.