The Hawaii ruling also halted a 120-day suspension of the US refugee admissions program.

President Donald Trump braced on Thursday for a long legal battle over his ban on travel from six mainly-Muslim countries after two federal judges ruled against the measure, saying the Republican's own comments suggested religious bias.

It was a humiliating setback for Mr. Trump, who saw his first attempt at limiting travel from the Muslim world halted by the federal courts last month after it had caused chaos at airports both in the US and abroad.

The White House said the Republican administration would "vigorously defend" its travel ban, after Trump vowed to challenge the "terrible" decision to suspend it, before the Supreme Court if necessary.

“We intend to appeal the flawed rulings,” said the president's spokesman Sean Spicer.

The revamped executive order had been due to take effect at midnight (0400 GMT), but a federal judge in Hawaii froze Trump's efforts to close U.S. borders to nationals of Iran, Libya, Somalia, Sudan, Syria and Yemen for 90 days.

Mr. Trump argues that his immigration order is needed to ensure national security and described the rulings against it as "unprecedented judicial overreach."

The Hawaii ruling also halted a 120-day suspension of the US refugee admissions program.

A second federal judge in Maryland issued a separate, more narrow nationwide block on just the core provision concerning travel from the Muslim world, ruling it would cause “irreparable harm” were it to go into effect.

Mr. Trump, who used anti-Muslim rhetoric on the campaign trail in his successful run for the White House, will now have to account for those statements in court, with both judges saying the order raised the specter of religious bias.

Muslim ban?

Mr. Trump's revised ban signed on March 6 had a reduced scope, exempting Iraqis, permanent US residents and valid visa holders — an effort by the administration to ensure the order passed legal muster.

The White House said the other six countries were targeted because their screening and information capabilities could not meet US security requirements.

In Hawaii, Acting Solicitor General Jeffrey Wall, defending the government's position, said: "This order doesn't draw any religious distinction at all."

Questioned about Trump's tweets and statements during the campaign in which he promised to enact a “Muslim ban,” Wall said: “There is a difference between a president and a candidate.”

But District Judge Derrick Watson rejected the idea that the order was not a Muslim ban, ruling it was plausible "to conclude that targeting these countries likewise targets Islam," given their Muslim populations all topped 90 percent.

The judge said "a reasonable, objective observer... would conclude that the Executive Order was issued with a purpose to disfavor a particular religion, in spite of its stated, religiously-neutral purpose."

He referred to several examples of Mr. Trump explicitly framing proposed action on immigration in religious tones, including a March 2016 interview during which the then president-elect said: "I think Islam hates us."

Watson indicated that the court would not stay its decision in the event of an appeal.

In Maryland, US District Judge Theodore Chuang echoed Watson's argument, as he issued a partial injunction on a separate complaint filed by advocacy groups claiming that the amended order discriminates against Muslims.

Three strikes and you're out?

Mr. Trump, addressing supporters late Wednesday in Nashville, assailed the Hawaii judge.

“The law in the Constitution gave the president the power to suspend immigration when he deems it to be in the national interest of our country,” 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 are going to win.”

The Justice Department called the Hawaii ruling "flawed both in reasoning and in scope."

The Hawaii and Maryland rulings came after a trio of hearings Wednesday on the ban.

In Seattle, Washington state's attorney general filed an emergency motion for a temporary restraining order that would last up to 14 days in order to halt the travel restrictions, also citing "irreparable injuries."

Rights groups and states contesting the ban welcomed the rulings.

“The Constitution has once again put the brakes on President Trump's disgraceful and discriminatory ban,” said Omar Jadwat, director of the immigrant rights project at the American Civil Liberties Union.

New York Attorney General Eric Schneiderman, who has joined the case in Washington state, said: “Today's order by the federal District Court of Hawaii marks yet another victory for the Constitution and the rule of law.”

Cornell University Law School professor Stephen Yale-Loehr warned Trump against a protracted battle.

“President Trump and his advisors should think long and hard before trying to impose a travel ban a third time. They may strike out,” he said.