SAN FRANCISCO/WASHINGTON (Reuters) - A U.S. judge on Tuesday blocked President Donald Trump’s latest bid to impose restrictions on citizens from several countries entering the United States, which would have taken effect this week.

The open-ended ban, announced last month, targeted people from Iran, Libya, Syria, Yemen, Somalia, Chad and North Korea, as well as certain government officials from Venezuela. It was the third version of a policy that had previously targeted some Muslim-majority countries but had been restricted by the courts.

Tuesday’s ruling sets up another high stakes battle over Trump’s executive authority which legal experts expect will ultimately land in the U.S. Supreme Court. Trump’s first travel ban in January caused chaos and protests at U.S. airports before judges halted it.

The state of Hawaii sued to block Trump’s latest travel restrictions, arguing that federal immigration law did not give him the authority to impose them on six of those countries. Hawaii did not challenge entry restrictions relating to North Korea and Venezuela.

U.S. District Judge Derrick Watson in Honolulu said Hawaii was likely to succeed in proving that Trump’s latest travel ban violates federal immigration law.

The policy “suffers from precisely the same maladies as its predecessor: it lacks sufficient findings that the entry of more than 150 million nationals from six specified countries would be ‘detrimental to the interests of the United States,’” Watson wrote.

The White House in a statement said the ruling was “dangerously flawed” and that it was confident the courts would ultimately uphold Trump’s policy.

“These restrictions are vital to ensuring that foreign nations comply with the minimum security standards required for the integrity of our immigration system and the security of our nation,” the statement said.

The Justice Department called Watson’s ruling “incorrect” and said it would appeal “in an expeditious manner.”

A family exits after clearing immigration and customs at Dulles International Airport in Dulles, Virginia, U.S. September 24, 2017. REUTERS/James Lawler Duggan

Following the ruling, the U.S. State Department instructed embassies and consulates around the world to “resume regular processing of visas” for citizens of Chad, Iran, Libya, Somalia, Syria and Yemen, a department official said on condition of anonymity.

The department will carry out the proclamation for North Korea and Venezuela “with the objective of maximizing national security,” the official said, because the order did not apply to restrictions on those countries.

As a candidate, Trump had promised “a total and complete shutdown of Muslims entering the United States.”

In announcing the newest travel restrictions, the White House had portrayed them as necessary consequences for countries that did not meet new requirements for vetting of immigrants and issuing of visas. Those requirements were shared in July with foreign governments, which had 50 days to make improvements if needed, the White House said.

A number of countries made improvements by enhancing the security of travel documents or the reporting of passports that were lost or stolen. Others did not, sparking the restrictions.

Immigrant advocacy groups cheered the Hawaii ruling.

“We’re glad, but not surprised, that President Trump’s illegal and unconstitutional Muslim ban has been blocked once again,” Omar Jadwat, director of the American Civil Liberties Union Immigrants Rights Project, said in a statement.

The ACLU and other groups have filed separate challenges to Trump’s policy in a Maryland federal court. A ruling is still pending.

In the Hawaii case, the judge said that the ban’s national security rationale was undermined by not knowing how the president settled on the countries designated by the ban.

The judge also said the proclamation likely runs afoul of a prohibition in immigration law on nationality-based discrimination in issuing visas. Watson had blocked Trump’s second travel ban in March.

In a statement on Tuesday, Hawaii Attorney General Doug Chin said: “Today is another victory for the rule of law.”

Kiyanoush Razaghi, an immigration attorney with the Catholic Legal Immigration Network who has many Iranian clients, said Iranians still have problems when applying for U.S. visas, including particularly lengthy wait times for security checks.

Razaghi said he has told his clients: “You can celebrate, there is no travel ban right now, but be careful because that doesn’t mean you are going to get a visa in a reasonable amount of time.”