WASHINGTON (Reuters) - The U.S. Supreme Court on Monday handed a victory to President Donald Trump by reviving parts of a travel ban on people from six Muslim-majority countries that he said is needed for national security but that opponents decry as discriminatory.

The justices narrowed the scope of lower court rulings that had completely blocked key parts of a March 6 executive order that Trump had said was needed to prevent terrorism attacks, allowing his temporary ban to go into effect for people with no strong ties to the United States. [tmsnrt.rs/2seb3bb]

The court issued its order on the last day of its current term and agreed to hear oral arguments during its next term starting in October so it can decide finally whether the ban is lawful in a major test of presidential powers.

In a statement, Trump called the high court’s action “a clear victory for our national security,” saying the justices allowed the travel suspension to become largely effective.

“As president, I cannot allow people into our country who want to do us harm. I want people who can love the United States and all of its citizens, and who will be hardworking and productive,” Trump added.

Trump’s March 6 order called for a blanket 90-day ban on people from Iran, Libya, Somalia, Sudan, Syria and Yemen and a 120-day ban on all refugees while the government implemented stronger vetting procedures. The court allowed a limited version of the refugee ban, which had also been blocked by courts, to go into effect.

Trump issued the order amid rising international concern about attacks carried out by Islamist militants like those in Paris, London, Brussels, Berlin and other cities. But challengers said no one from the affected countries had carried out attacks in the United States.

Federal courts said the travel ban violated federal immigration law and was discriminatory against Muslims in violation of the U.S. Constitution. Critics called it a discriminatory “Muslim ban.”

Ahmed al-Nasi, an official in Yemen’s Ministry of Expatriate Affairs, voiced disappointment.

“We believe it will not help in confronting terrorism and extremism, but rather will increase the feeling among the nationals of these countries that they are all being targeted, especially given that Yemen is an active partner of the United States in the war on terrorism and that there are joint operations against terrorist elements in Yemen,” he said.

Groups that challenged the ban, including the American Civil Liberties Union, said that most people from the affected countries seeking entry to the United States would have the required connections. But they voiced concern the administration would interpret the ban as broadly as it could.

“It’s going to be very important for us over this intervening period to make sure the government abides by the terms of the order and does not try to use it as a back door into implementing the full-scale Muslim ban that it’s been seeking to implement,” said Omar Jadwat, an ACLU lawyer.

During the 2016 presidential race, Trump campaigned for “a total and complete shutdown” of Muslims entering the United States. The travel ban was a signature policy of Trump’s first few months as president.

Slideshow ( 11 images )

‘BONA FIDE RELATIONSHIP’

In an unusual unsigned decision, the Supreme Court on Monday said the travel ban will go into effect “with respect to foreign nationals who lack any bona fide relationship with a person or entity in the United States.”

A lack of a clearly defined relationship would bar from entry people from the six countries and refugees with no such ties.

Slideshow ( 11 images )

Hawaii Attorney General Douglas Chin, who successfully challenged the ban in lower courts, said that students from affected countries due to attend the University of Hawaii would still be able to do so.

Both bans were to partly go into effect 72 hours after the court’s decision. The Department of Homeland Security and the State Department pledged to implement the decision in an orderly fashion.

“We will keep those traveling to the United States and partners in the travel industry informed as we implement the order in a professional, organized, and timely way,” a State Department spokeswoman said.

Trump signed the order as a replacement for a Jan. 27 one issued a week after he became president that also was blocked by federal courts, but not before it caused chaos at airports and provoked numerous protests.

Even before the Supreme Court action the ban applied only to new visa applicants, not people who already have visas or are U.S. permanent residents, known as green card holders. The executive order also made waivers available for a foreign national seeking to enter the United States to resume work or study, visit a spouse, child or parent who is a U.S. citizen, or for “significant business or professional obligations.” Refugees “in transit” and already approved would have been able to travel to the United States under the executive order.

A CONSERVATIVE COURT

The case was Trump’s first major challenge at the Supreme Court, where he restored a 5-4 conservative majority with the appointment of Neil Gorsuch, who joined the bench in April. There are five Republican appointees on the court and four Democratic appointees. The four liberal justices were silent.

Gorsuch was one of the three conservative justices who would have granted Trump’s request to put the order completely into effect. Fellow conservative Justice Clarence Thomas wrote a dissenting opinion in which he warned that requiring officials to differentiate between foreigners who have a connection to the United States and those who do not 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,” Thomas wrote.

The state of Hawaii and a group of plaintiffs in Maryland represented by the American Civil Liberties Union argued that the order violated federal immigration law and the Constitution’s First Amendment prohibition on the government favoring or disfavoring any particular religion. Regional federal appeals courts in Virginia and California both upheld district judge injunctions blocking the order.