A federal judge in Hawaii blocked most of President Donald Trump's latest travel ban on Tuesday just hours before it was set to take effect, saying the revised order ''suffers from precisely the same maladies as its predecessor''.
It was the third set of travel restrictions issued by the president to be thwarted, in whole or in part, by the courts.
US District Judge Derrick Watson issued the ruling after the ban on a set of mostly Muslim countries was challenged by the state of Hawaii, which warned that the restrictions would separate families and undermine the recruiting of diverse college students.
Hawaii has been at the forefront in resisting Trump's various travel bans.
The judge said the latest Executive Order ('EO3') lacks sufficient findings that the entry of nationals from six specified countries would be ''detrimental to the interests of the United States''.
White House spokeswoman Sarah Huckabee Sanders called the ruling ''dangerously flawed'' and said it ''undercuts the president's efforts to keep the American people safe''. The Justice Department said it will appeal quickly.
At issue was a ban, announced in September and set to go into effect early Wednesday, on travellers from Chad, Iran, Libya, North Korea, Somalia, Syria and Yemen, along with some Venezuelan government officials and their families.
The Trump administration said the ban was based on an assessment of each country's security situation and willingness to share information with the US.
Watson, appointed to the bench by President Barack Obama, said the new restrictions ignore a federal appeals court ruling against Trump's previous ban.
The latest version ''plainly discriminates based on nationality in the manner that the 9th Circuit has found antithetical to ... the founding principles of this nation,'' Watson wrote.
The judge's ruling applies only to the six Muslim-majority countries on the list. It does not affect the restrictions against North Korea or Venezuela, because Hawaii did not ask for that.
''This is the third time Hawaii has gone to court to stop President Trump from issuing a travel ban that discriminates against people based on their nation of origin or religion,'' Hawaii Attorney General Doug Chin said in a statement.
''Today is another victory for the rule of law.''
Hawaii argued the updated ban was a continuation of Trump's campaign call for a ban on Muslims, despite the addition of two countries without a Muslim majority.
Watson noted that Hawaii had argued Trump did not back down from that call, listing in the ruling a series of June tweets ''in which (Trump) complained about how the Justice Department had submitted a 'watered down, politically correct version' to the Supreme Court''.
Other courts that weighed the travel ban have cited Trump's comments about banning Muslims, including the 4th US Circuit Court of Appeals in Virginia and a federal judge in Maryland. Watson also referred to a Trump campaign statement in his previous ruling.
His Tuesday ruling said the new ban, like its predecessor, fails to show that nationality alone makes a person a greater security risk to the US.
''The categorical restrictions on entire populations of men, women and children, based upon nationality, are a poor fit for the issues regarding the sharing of 'public-safety and terrorism-related information' that the president identifies,'' Watson wrote.
He said the ban is inconsistent in the way some countries are included or left out. For example, Iraq failed to meet the security benchmark but was omitted from the ban. Somalia met the information-sharing benchmark but was included.
Watson found fault with what sorts of visitors are barred. For instance, all tourists and business travellers from Libya were excluded from the US, but student visitors were allowed.
The judge said he would set an expedited hearing to determine whether the temporary restraining order blocking the ban should be extended. It comes as other courts weigh challenges to the ban.
In Maryland, the American Civil Liberties Union and other groups are seeking to block the visa and entry restrictions. Washington State, Massachusetts, California, Oregon, New York and Maryland are challenging the order in front of the same federal judge in Seattle who struck down Trump's initial ban in January.
That ban - aimed mostly at Muslim-majority countries - led to chaos and confusion at airports nationwide and triggered several lawsuits, including one from Hawaii.
When Trump revised the ban, Hawaii challenged that version, too, and Watson agreed it discriminated on the basis of nationality and religion. A subsequent US Supreme Court ruling allowed the administration to partially reinstate restrictions against Iran, Libya, Somalia, Sudan, Syria and Yemen and against all refugees.
Hawaii then successfully challenged the government's definition of which relatives of people already living in the US would be allowed into the country, and Watson ordered the list expanded.