A federal judge in Hawaii blocked President Trump’s revised extreme vetting policy Wednesday, just hours before it was to take effect, saying the president’s “religious animus” toward Muslims during the campaign had poisoned the executive order.

Administration attorneys had rewritten the policy to try to appease the courts after a first go-around was blocked by a judge in Seattle and then by an appeals court.

But U.S. District Judge Derrick Watson said the new version was still tainted by Mr. Trump’s comments as a candidate about his desire to curb Muslim immigration in an effort to battle Islamist extremism.

Citing comments made by Mr. Trump and administration officials, Judge Watson said “significant and unrebutted evidence of religious animus” was behind the original and revised versions of the executive order, and he ruled in favor of the Hawaii attorney general and state resident Ismail Elshikh, a Muslim who was one of the plaintiffs.

“These plainly worded statements, made in the months leading up to and contemporaneous with the signing of the Executive Order, and, in many cases, made by the Executive himself, betray the Executive Order’s stated secular purpose,” Judge Watson wrote in his 43-page ruling.

He added that the order likely violated the Constitution’s protection against religious discrimination.

He issued his ruling in the nick of time for immigrant and refugee advocacy groups, which hoped to stop the revised order from taking effect at 12:01 a.m. Thursday.

Mr. Trump, speaking at a rally in Nashville, Tennessee, called the decision “an unprecedented judicial overreach” and rhetorically asked the crowd whether they thought the Obama-appointed judge issued the ruling “for political reasons.”

“This ruling makes us look weak,” he said. “We are going to take our case as far as it needs to go, including all the way up to the Supreme Court. We’re going to win.”

Mr. Trump said federal immigration law gives him and every other president the power to determine who is admitted to the country and judges can’t constrain such national security powers.

“This goes beyond me because there will be other presidents, and we need this,” he said, reading out a section of the law.

Justice Department spokeswoman Sarah Isgur Flores called the judge’s ruling “flawed both in reasoning and in scope.”

She reiterated that the order “falls squarely within the president’s lawful authority in seeking to protect our nation’s security” and said the Justice Department would continue to defend the order in the courts.

Hawaii Attorney General Douglas Chin charged in his lawsuit against the revised order that the state’s residents, universities, businesses, health care systems and religious organizations would be harmed by the revised order.

Attorney Colleen Roh Sinzdak explained in court how Mr. Elshikh, the imam of the Muslim Association of Hawaii, worried that his mother-in-law, a Syrian national, would be barred from coming to the U.S. under the travel ban.

She said Mr. Elshikh had standing to challenge the ban and that because of the order, all Muslim residents in Hawaii face higher hurdles in reuniting with family members because of their faith.

Justice Department attorneys said the president can restrict the entry of foreign nationals into the U.S. when their entry “would be detrimental to the interests of the United States.”

Attorneys have also said legal concerns initially raised over the first executive order were addressed by the administration’s decision to narrow the order’s scope and to add provisions that lay out a waiver process for those who might be denied visas.

Arguing a separate case Wednesday that was brought in Maryland, acting Solicitor General Jeffrey Wall said the countries from which visa applications would be restricted were already identified by the Obama administration to be removed from the visa waiver program.

He said the Trump administration took those groups “and said we are making different judgment on the amount of risk we are willing to tolerate.”

In written briefs filed in the Hawaii case, the Justice Department defended the executive order against an accusation that it amounted to a Muslim ban by saying the six countries “represent only a small fraction of the world’s 50 Muslim-majority nations, and are home to less than 9% of the global Muslim population.”

The Justice Department also noted that the order covers “every national of those countries, including millions of non-Muslim individuals in those countries.”

But Judge Watson disagreed.

“The illogic of the Government’s contentions is palpable,” he wrote. “The notion that one can demonstrate animus toward any group of people only by targeting all of them at once is fundamentally flawed.”

CNN legal analyst Jeffrey Toobin said that relying on a political official’s campaign rhetoric to declare a facially constitutional exercise of power is “unprecedented in my experience” and predicted that it would make Judge Watson’s ruling “vulnerable on appeal.”

Venerable Harvard Law School professor Alan Dershowitz agreed, saying Mr. Trump’s order is plainly constitutional unless the Supreme Court takes into account Mr. Trump’s rhetoric.

“The same words [of an order] are constitutional if Barack Obama does it, unconstitutional if Donald Trump does it,” he said on CNN, predicting that the Supreme Court would not make such a politically loaded decision.

Mr. Trump noted those words just minutes later in his Nashville speech, bragging that “even liberal Democratic lawyer Alan Dershowitz just said we would win this case.”

Under the latest executive order, citizens of six Muslim-majority countries — Iran, Libya, Somalia, Sudan, Syria and Yemen — would be banned from obtaining visas to come to the United States for 90 days. Iraq was dropped from the original list of banned countries.

The revised version would halt for 120 days all refugee resettlement, though it removed the original order’s permanent ban on refugees from Syria and exemptions for religious minorities, namely Christians. It also lowered the number of refugees accepted by the U.S. this year from 110,000 people to 50,000.

The Trump administration pledged that while the temporary ban was in effect, the government would develop an extreme vetting program for all foreign visitors to the U.S., including a biometric entry/exit system to identify who is arriving to and departing from the country.

The Federation for American Immigration Reform said the Trump administration could make a case for appealing the ruling directly to the Supreme Court.

“This decision is without precedent and constitutes a national emergency because courts would now appear to be forcing the country to accept possible terrorists,” said FAIR President Dan Stein, whose organization backs lower levels of legal and illegal immigration.

Judge Watson was one of three federal judges who heard arguments from civil rights groups, individual plaintiffs and state officials who challenged the legality of Mr. Trump’s revised order and sought to prevent it from taking effect.

In Maryland, U.S. District Judge Theodore D. Chuang heard arguments from the American Civil Liberties Union and the International Refugee Assistance Project.

“Generally, courts defer on national security to the government,” Judge Chuang said. “Do I need to conclude that the national security purpose is a sham and false?”

In response, ACLU attorney Omar Jadwat said the government had put out misleading and contradictory information about whether banning travel from six specific countries would make the nation safer.

After the ruling came down in Hawaii’s case, Mr. Jadwat said, “The Constitution has once again put the brakes on President Trump’s disgraceful and discriminatory ban.”

In Washington state, U.S. District Judge James Robart heard two separate cases — a lawsuit brought by the Northwest Immigrant Rights Project and an emergency motion brought by Washington Attorney General Bob Ferguson, who had filed a litany of motions over the last few days hoping to block the order from taking effect.

As of late Wednesday, neither Judge Robart nor Judge Chuang had issued any ruling on the order.

Mr. Ferguson called news of the temporary restraining order “amazing.”

“Today’s rapidly evolving events show the strength of our growing coalition from the Eastern Seaboard to the Hawaiian islands,” he said.

• Stephen Dinan contributed to this article, which is based in part on wire service reports.

Sign up for Daily Newsletters Manage Newsletters

Copyright © 2020 The Washington Times, LLC. Click here for reprint permission.