SAN FRANCISCO/WASHINGTON (Reuters) - President Donald Trump suffered another legal setback on Monday as a second federal appeals court refused to revive his travel ban on people entering the United States from six Muslim-majority nations in a dispute headed to the U.S. Supreme Court.

The San Francisco-based 9th U.S. Circuit Court of Appeals used narrow grounds to reject the Trump administration’s bid to undo a Hawaii federal judge’s decision blocking the temporary ban. It said the Republican president’s March 6 order violated existing immigration law. But the three-judge panel - all Democratic appointees - did not address whether it was unconstitutional discrimination against Muslims.

A second court, the Richmond, Virginia-based 4th U.S. Circuit Court of Appeals, on May 25 upheld a Maryland judge’s ruling that also blocked Trump’s 90-day ban on travelers from Libya, Iran, Somalia, Sudan, Syria and Yemen.

The 4th Circuit had ruled that the ban, which replaced an earlier Jan. 27 one also blocked by the courts, “drips with religious intolerance, animus and discrimination” aimed at Muslims.

The 9th Circuit largely left in place a nationwide injunction by Judge Derrick Watson that stopped parts of the order, which Trump said was urgently needed to prevent terrorism in the United States. That ruling came in a lawsuit challenging the order brought by the state of Hawaii, which stated the ban would harm its universities and tourism industry.

Even before Monday’s ruling, the case was on the fast track to the Supreme Court, where the administration on June 1 filed an emergency request seeking to reinstate the order and hear its appeal of the 4th Circuit ruling. The Supreme Court could act on the administration’s request as soon as this week.

Trump has been on the losing side in all four court rulings on the March order. White House spokesman Sean Spicer said the administration is reviewing Monday’s decision and expressed continued confidence that the order is fully lawful and ultimately will be upheld by the Supreme Court.

“I think we can all attest that these are very dangerous times and we need every available tool at our disposal to prevent terrorists from entering the United States and committing acts of bloodshed and violence,” Spicer told a briefing.

The 9th Circuit upheld the block on Trump’s three-month travel ban for the six countries and four-month suspension of all refugee admissions. But the court pared back part of Watson’s injunction in order to allow the government to conduct internal reviews on vetting procedures for these travelers.

FILE PHOTO - International travelers arrive at Logan airport following U.S. President Donald Trump's executive order travel ban in Boston, Massachusetts, U.S. February 3, 2017. REUTERS/Brian Snyder

The administration said the travel ban was needed to allow time to implement stronger vetting measures, although it has already rolled out some new requirements not blocked by courts, including additional questions for visa applicants.

Rather than focusing on Trump campaign statements as the Virginia-based court did, the 9th Circuit said the language in the executive order itself did not make a rational case for why a travel ban was needed.

“The order does not offer a sufficient justification to suspend the entry of more than 180 million people on the basis of nationality,” the court wrote, referring the combined populations of the six countries.

‘ATTRACTIVE WAY’

Under immigration law, the administration was required to make findings that entry of the people in question would be detrimental to the United States but failed to do so, the court said.

Stephen Vladeck, a professor at University of Texas School of Law, said the 9th Circuit provided an easier path for the Supreme Court to keep the travel ban on hold, because it avoided entirely the controversy over Trump’s campaign statements.

“It provides a very attractive way to leave the injunction in place without setting broader doctrinal rules about which they may have pause,” Vladeck said.

Trump during the 2016 presidential campaign called for a “total and complete shutdown of Muslims entering the United States.”

Monday was the deadline for the ban’s challengers to respond to the administration’s request that the order be allowed to go into effect. The American Civil Liberties Union, which represents people challenging the ban in the separate Maryland suit handled by the 4th Circuit, filed court papers urging the court not to take up the case, saying the order will become moot on Wednesday, 90 days from when Trump issued it.

Lawyers for Hawaii called the order a “thinly veiled Muslim ban.”

Trump’s earlier Jan. 27 order also included Iraq among the countries targeted and a total ban on refugees from Syria. The March order was intended to overcome the legal issues posed by the original ban, but was blocked before it could go into effect on March 16.

The suits by Hawaii and the Maryland challengers argued that the order violated federal immigration law and a section of the Constitution’s First Amendment that prohibits the government from favoring or disfavoring any particular religion.

Hawaii’s court papers mentioned a series of Trump Twitter posts on June 5. Trump described the order as a “watered down, politically correct” version of his original one.