Alan Gomez

USA TODAY

Corrections & Clarifications: A previous version of this article omitted Yemen as one of the six majority-Muslim nations targeted by President Trump’s revised travel ban.

A federal judge in Hawaii on Wednesday issued a nationwide halt to President Trump's temporary travel ban targeting six majority-Muslim countries. It was a stinging rebuke of Trump's second attempt to institute the controversial order just hours before it was to take effect.

U.S. District Judge Derrick Watson wrote in his ruling that the federal government had not proved the ban was needed to protect the U.S. from terrorists trying to infiltrate the country through legal immigration or the refugee program. He wrote that despite changes made by the White House to the new ban, it clearly violated constitutional protections of religion based on comments made by Trump throughout his presidential campaign.

"A review of the historical background here makes plain why the Government wishes to focus on the Executive Order’s text, rather than its context," Watson wrote. "The record before this Court is unique. It includes significant and unrebutted evidence of religious animus driving the promulgation of the Executive Order and its related predecessor."

Watson, who was appointed by President Obama in 2013, issued a temporary restraining order, and wrote that it would remain in effect if the Department of Justice appeals the ruling.

Trump called the ruling an "unprecedented judicial overreach" during a rally in Nashville, Tenn., on Wednesday night. He hinted that Watson’s ruling was motivated by “political reasons,” and said he would appeal the case all the way to the Supreme Court if necessary.

Trump also quoted from a federal law that gives presidents the power to bar whole classes of immigrants if the president unilaterally deems them “detrimental to the interests of the United States.”

“Whoever is president can say ‘I’m sorry folks, not now, please, we’ve got enough problems,’” Trump said. “We’re talking about the safety of our nation, the safety and security of our people.”

The Department of Justice followed up Wednesday night, saying it "strongly disagrees" with the ruling, calling it "flawed both in reasoning and in scope." In a statement, the department said it would continue defending Trump's order in court.

Reaction also poured in from lawyers who opposed the ban.

"Aloha TRO," said Karen Tumlin, legal director for the National Immigration Law Center, referring to the legal shorthand for a temporary restraining order. "This finds, based on constitutional grounds, that indeed the new executive order, just like the first executive order, meant to enact a state policy denigrating Muslims."

Also applauding the court action was New Mexico Attorney General Hector Balderas, who said in a statement that he supported ruling to "halt President Trump's new, illegal travel ban."

“I am pleased that the judge agreed that this new executive order was enacted with a clear, discriminatory intent to act as a poorly-disguised Muslim ban, and that the ban would harm our universities and economy in New Mexico,” Balderas said.

Virginia Attorney General Mark R. Herring said Trump's travel ban is "tainted."

"President Trump tried to trim and tailor his new ban to avoid legal problems, but when something is as tainted as his Muslim ban it's not hard to see it for exactly what it is," Herring said. "I'm proud to have been part of the fight against this unlawful, unconstitutional, and deeply un-American ban, both in courts here in the Commonwealth and as part of a united effort of state attorneys general."

Trump's second attempt to limit travel from those countries was set to go into effect at 12:01 ET Thursday. A group of states, immigration and refugee advocacy groups, and private residents filed lawsuits to block it, as happened when Trump issued his first travel order in late January. Judges in Hawaii, Maryland and Washington state heard arguments on those legal challenges Wednesday, with Hawaii being the first to issue a ruling.

The executive order, signed by Trump on March 6, bars citizens of Iran, Libya, Somalia, Sudan, Syria and Yemen for 90 days and all refugees for 120 days. It includes several changes from the original ban struck down in court.

Iraq was removed from the list after its government agreed to enhanced screening of its citizens. An indefinite ban on Syrians was dropped. And the new order made clear that nationals of those six countries with valid visas or legal permanent residence (known as green cards) would not be restricted from traveling.

During Wednesday's hearings, government lawyers said those changes were designed to address the concerns raised by judges who blocked the first order. They said the government also removed a section of the original order that gave preference to persecuted religious minorities, which Trump has said was designed to help Christians trying to immigrate from those majority Muslim countries.

But lawyers trying to block Trump's order argued that those tweaks don't change the underlying problem of the order — that it discriminates against Muslims. Those groups have taken to calling Trump's new order "Muslim Ban 2.0" and say it represents the illegal implementation of his campaign promise to institute a "total and complete shutdown of Muslims entering the United States."

Read more:

Trump's new travel ban takes effect Thursday—unless blocked again

Analysis: Trump's new travel ban will face another tough legal battle

Appeals court refuses to reinstate Trump's travel ban

Watson agreed, shooting down the government's position that the order was "religiously-neutral" and dedicating much of the ruling to the government's clear intention to "disfavor a particular religion."

The judge laid out several comments made by Trump on the campaign trail that he would ban Muslims from entering the U.S. The judge also listed comments made by Trump's advisers after the ban was first implemented. That included an interview given by Stephen Miller, a senior policy adviser who helped craft the travel ban, when he said that the revised order made technical corrections but had the "same basic policy outcome" as the original.

Government lawyers tried to argue the order could not be viewed as a "Muslim ban" since it only targeted six countries that represent only about 9% of the world's Muslim population. But Watson disagreed, writing that "the illogic of the Government's contentions is palpable."

"The notion that one can demonstrate animus toward any group of people only by targeting all of them at once is fundamentally flawed," Watson wrote.

Watson's ruling followed a hectic day where government lawyers fanned out across the country to fight off legal challenges to the ban.

A federal judge in Maryland heard a challenge from a group of refugee resettlement organizations that claimed the new order violates the religious freedom of refugees. And U.S. District Judge James Robart, who halted Trump's first executive order, heard a challenge from a group of states including Washington, California, Maryland, Massachusetts, New York and Oregon.

Trump's first ban, signed Jan. 27, went into effect immediately, triggering chaos at airports around the world, as travelers overseas were blocked from boarding U.S.-bound flights and those in transit were detained at U.S. airports.

Robart halted the order, finding that it may have violated the rights of visa holders and legal permanent residents. That ruling was upheld by the 9th U.S. Circuit Court of Appeals in San Francisco.

Trump lashed out at Robart, calling him a "so-called judge," and at the 9th Circuit, saying their decision was politically motivated. The three-judge panel, which included two appointed by Democratic presidents and one by a Republican, issued a unanimous ruling.

Rather than continue fighting those rulings, the White House decided to revoke the initial order and replace it with the new, revised order, which no longer would ban those with permanent resident status or valid shorter-term visas.

Contributing: Richard Wolf in Washington, D.C.