A federal judge in Hawaii blocked most of President Donald Trump’s latest travel ban today, 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 President Donald Trump to be thwarted, in whole or in part, by the courts.

U.S. 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.

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 quickly appeal.

At issue was a ban, announced in September and set to go into effect early Wednesday, on travelers 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 U.S.

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 the state of 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 to the list of two countries without a Muslim majority.

In his ruling, the judge said the new ban, like its predecessor, fails to show that nationality alone makes a person a greater security risk to the U.S.

“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 said.

He also said the ban in 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 also found fault with what sorts of visitors are barred. For instance, all tourists and business travelers from Libya are excluded from the U.S., but student visitors were allowed.

The judge said he would set an expedited hearing to determine whether his temporary restraining order blocking the ban should be extended.

Other courts are weighing 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 U.S. 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 U.S. would be allowed into the country, and Watson ordered the list expanded.

Order granting motion for Temporary Restraining Order by Honolulu Star-Advertiser on Scribd