A judge in Hawaii blocked both the order's suspension of refugee admissions and its ban on issuing new visas to people from a group of six countries.

Judge Derrick Watson pointed to statements made by Trump and his associates both before and after the president was elected in November as justification to halt the order, which was to take effect hours later, because of a constitutional clause that requires government actions to have a primarily secular purpose.

Trump's campaign once included a call to ban all Muslims from entering the United States, a policy that was later changed to advocating “extreme vetting” for people from countries with a link to terrorism.

Judge Watson said the case before him included “significant and unrebutted evidence of religious animus driving the promulgation of the executive order and its related predecessor.”

A federal judge in Maryland also cited Trump's comments in issuing a separate injunction later Wednesday, but that ruling applies only to the visa ban portion of the executive order, and not the section on the refugee program.

“If I were legal counsel, any kind of counsel, to the president, I would tell him to stop with the inflammatory rhetoric because he is undermining his own goals,” said David Abraham, professor of immigration and citizenship law at the University of Miami (Florida) School of Law.

Abraham said as recently as Wednesday's rally in Nashville, Tennessee, the president was using rhetoric that could hurt him in court by indicating that the new travel order is not really different from the old one.

“As he did again last night in his address, the president said, ‘Well we cleaned it up. It's basically what I wanted before; it's the same thing. In fact, I like the other one even better.’ So in some ways so the president is creating his own bad static.”

The Trump administration says the travel order is necessary to protect the country from the threat of terrorism. It features a four-month ban on admitting any refugees and a three-month freeze on issuing visas to people from Iran, Syria, Yemen, Libya, Somalia and Sudan.

An earlier version of the order included Iraq in the targeted countries, as well as a clause that exempted religious minorities from the ban.

Trump said the court's ruling makes the United States look weak, and that he will continue the legal battle.

“The danger is clear, the law is clear, the need for my executive order is clear,” he told supporters at the Tennessee rally. “I was elected to change our broken and dangerous system and thinking in government that has weakened and endangered our country and left our people defenseless.”

The first step in the appeals process would be filing a claim with the 9th Circuit Court of Appeals, which upheld a hold on the original travel order by a Washington state court. Hawaii is also in the Ninth Circuit.

But Leon Fresco, an immigration attorney who served as deputy assistant attorney general for the DOJ Civil Division's Office of Immigration Litigation during President Barack Obama's administration, expects the order to have little success at the appeals level and even eventually at the Supreme Court level.

“I think it was an interesting ruling in the sense that the court is taking a very bold statement on saying that the actions in the administration have basically irrevocably tainted any effort to move forward with this travel executive order,” Fresco told VOA via Skype.

However, Fresco said he thinks the president's statutory authority to ban people is “absolutely vital to the country,” and shouldn't be weakened by what he called “an ill-conceived travel ban with ill-conceived statements.”

“If you think someone is dangerous, just deny their visa. You don't need a ban,” he said. “And the fact that they created these waivers just shows you that they basically are implementing a normal visa system. They're saying deny it unless there's some reason to grant it. There's no reason you couldn't do that now, just don't have a categorical ban.”

A supporter of President Donald Trump holds up a sign at a rally, March 15, 2017, in Nashville, Tennessee.