The action Monday is a victory for President Donald Trump in the biggest legal controversy of his young presidency.

The court did leave one category of foreigners protected, those "with a credible claim of a bona fide relationship with a person or entity in the United States," the court said in an unsigned opinion. 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 ban would apply to citizens of Iran, Libya, Somalia, Sudan, Syria and Yemen.

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

Copyright 2017 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.