WASHINGTON — The U.S. Supreme Court gave the Trump administration the go-ahead Monday to begin enforcing part of the president's executive order restricting travel from six predominately Muslim countries.

The court also agreed to take up the Trump administration's appeal of lower court rulings that have prevented the government from carrying out the president's policy, which the White House said was necessary to help prevent terrorists from entering the country.

It was an important legal victory for the White House after a string of defeats over the issue.

Trump, in a statement, also called the court's action "a clear victory for our national security."

"Today's ruling allows me to use an important tool for protecting our Nation's homeland," Trump said in the statement. "I am also particularly gratified that the Supreme Court's decision was 9-0."

The Supreme Court's actions mean much of the travel ban can be enforced for the next several months, at least until the justices hear the case when their new term begins in the fall.

Monday's ruling means the travel ban "may not be enforced against foreign nationals who have a credible claim of a bona fide relationship with a person or entity in the United States,” the court wrote. So the ban cannot be applied to visa applicants who have a close relationship to a family member in the U.S. or who want to come here to study or accept a job offer.

But the ban can now be enforced against all other visa applicants in the six affected countries.

"For example, a nonprofit group devoted to immigration issues may not contact foreign nationals from the designated countries, add them to client lists, and then secure their entry by claiming injury from their exclusion," the court wrote.

According to a presidential memo issued earlier this month, the permissible portions of the ban would go into effect 72 hours following the court's actions. The Department of Homeland Security in a statement on Monday said it will give further details on implementing portions of the ban after consulting with the Justice and State Departments.

Attorney General Jeff Sessions also applauded the court's choice to hear the case and said the Department of Justice looks forward to arguing the administration's position this fall.

"We have seen far too often in recent months that the threat to our national security is real and becoming increasingly dangerous. Groups like ISIS and al Qaeda seek to sow chaos and destruction in our country, and often operate from war-torn and failed countries while leading their global terror network," Sessions said in a statement. "It is crucial that we properly vet those seeking to come to America from these locations, and failing to do so puts us all in danger."

The court’s unsigned order was unanimous on granting the administration’s appeal. The only noted dissent came from Justices Clarence Thomas, Samuel Alito, and Neil Gorsuch, who said they would have allowed the travel ban to be enforced in full. The opinion was signed from the full court. None of the centrist or liberal justices filed a dissent.

People carry posters during a rally in support of Muslim Americans and protesting President Donald Trump's immigration policies in Times Square, New York on Feb. 19, 2017. Andres Kudacki / AP file

The executive order calls for a 90-day ban on issuing visas to citizens of Iran, Sudan, Syria, Libya, Somalia, and Yemen who want to come to the U.S. But unlike the first executive order, this one does not apply to anyone who has already obtained a valid visa.

People who show up at overseas airports with a visa will be allowed to board flights to the U.S. and will be allowed to enter the country when they get here, a Homeland Security official said.

That's a change from the first order, which went into effect shortly after President Donald Trump signed it in January, producing scenes of chaos at American airports as people who boarded flights with visas were not allowed to enter the country once they got here. The first order was blocked by the courts after it had been in effect for a week.

Related: Trump Tweets in Favor of 'Original' Travel Ban

The revised order — the subject of the current Supreme Court appeal — was to go into effect in mid-March, but court rulings have prevented its enforcement.

Because the Supreme Court will not hear the case until early October, the 90-day ban will likely have lapsed by the then. In that event, the case might then be dismissed as moot. But the administration would have succeeded in fully carrying out the executive order in the meantime.

The Justice Department urged the court to lift the ban on enforcement imposed by two lower courts. It said the measure had a legitimate national security purpose, allowing the government to assess the reliability of background information on visa applicants from six countries associated with terrorism.

The 4th Circuit Court of Appeals, based in Richmond, Virginia, upheld a ruling by a federal judge in Maryland who declared in March that the president's revised travel order amounted to unconstitutional religious discrimination.

Its ruling cited campaign statements by Trump, who originally called for a ban on Muslim immigration. His comments "provide direct, specific evidence" of what motivated his executive orders — "President Trump's desire to exclude Muslims from the United States," the appeals court said.

Then in mid-June, a panel of three judges from the 9th Circuit Court of Appeals upheld a ruling by a federal judge in Hawaii that also blocked enforcement. The appeals court said the executive order violated federal immigration laws that require a more substantial national security justification than the White House offered.

The court will said it will hear the case when its new term begins in early October.