WASHINGTON — President Trump's third attempt to ban travel from several predominantly Muslim nations met the same fate Tuesday as the first two: It was blocked nationwide by a federal judge in Hawaii.

The ban, which was to go into effect Wednesday, "suffers from precisely the same maladies as its predecessor," Judge Derrick Watson wrote. "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,'" and it "plainly discriminates based on nationality."

The 40-page ruling will be appealed by the Justice Department, but it throws a monkey wrench into the administration's plans on the eve of the latest ban taking effect.

The White House called Watson's ruling "dangerously flawed" and a threat to national security. It said the latest version of the travel ban was a carefully constructed measure implemented after a thorough review by the departments of Homeland Security, State, Defense and Justice.

"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 read.

Trump's earlier bans, from January and March, were struck down by several federal courts before the Supreme Court allowed part of the second ban to take effect in late June. That ban expired last month, to be replaced by an indefinite prohibition against some travelers from an expanded group of countries.

Trump's third version blocks specific travelers from five of the original nations — Iran, Libya, Somalia, Syria and Yemen — along with Chad, North Korea and Venezuela. Iraq and Sudan were subtracted from the list in March and September, respectively.

The latest travel ban also has been challenged in federal court in Maryland, where oral arguments were held Monday.

Hawaii Attorney General Doug Chin heralded Watson's ruling against a ban that he said "discriminates against people based on their nation of origin or religion."

"Today is another victory for the rule of law," Chin said. "We stand ready to defend it.”

In his decision, Watson said the ban was "simultaneously overbroad and underinclusive" because it targets entire countries rather than dangerous individuals, yet leaves out even potentially dangerous individuals from most countries.

Trump, he said, does not have "unbridled discretion to do as he pleases."

"National security and the protection of our borders is unquestionably also of significant public interest," Watson said. "Although national security interests are legitimate objectives of the highest order, they cannot justify the public’s harms when the president has wielded his authority unlawfully."