WASHINGTON — The Supreme Court is letting a limited version of President Donald Trump’s ban on travel from six mostly Muslim countries take effect, a victory for Trump in the biggest legal controversy of his young presidency.

The justices will hear full arguments in October in the case that has stirred heated emotions across the nation. In the meantime, the court said Monday that Trump’s ban on visitors from Iran, Libya, Somalia, Sudan, Syria and Yemen can be enforced as long if those visitors lack a “credible claim of a bona fide relationship with a person or entity in the United States.”

Trump said last week that the ban would take effect 72 hours after being cleared by courts. Following the high court’s announcement today, Trump said in a statement that the decision on his travel ban is a “clear victory for our national security.”

The administration has said the 90-day ban was needed on national security grounds to allow an internal review of screening procedures for visa applicants from the six countries. Opponents say the ban was an unlawful bar based on visitors’ Muslim religion. The administration 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 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.

Some immigration lawyers said the limited nature of the ban and the silence of the court’s liberals on the issue Monday suggested that the court had not handed Trump much of a victory. The White House did not immediately comment.

The court’s opinion explained the kinds of relationships people from the six countries must demonstrate to obtain a U.S. visa.

“For individuals, a close familial relationship is required,” the court said. For people who want to come to the United States to work or study, “the relationship must be formal, documented and formed in the ordinary course, not for the purpose of evading” the travel ban.

The opinion faulted the two federal appeals courts that had blocked the travel policy for going too far to limit Trump’s authority over immigration. The president announced the travel ban a week after he took office in January and revised it 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 Iraq and well as the six countries, 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 whom 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.

— BY MARK SHERMAN, ASSOCIATED PRESS

READ MORE: What’s next in the legal fight over Trump’s travel ban?