A federal judge in Hawaii issued a nationwide order Wednesday evening blocking President Trump’s ban on travel from parts of the Muslim world, dealing a political blow to the White House and signaling that proponents of the ban face a long and risky legal battle ahead.
The ruling was the second frustrating defeat for Mr. Trump’s travel ban, after a federal court in Seattle halted an earlier version of the executive order last month. Mr. Trump responded to that setback with fury, lashing out at the judiciary before ultimately abandoning the order.
He issued a new and narrower travel ban on March 6, with the aim of pre-empting new lawsuits by abandoning some of the most contentious elements of the first version.
But Mr. Trump evidently failed in that goal: Democratic states and nonprofit groups that work with immigrants and refugees raced into court to attack the updated order, alleging that it was a thinly veiled version of the ban on Muslim migration that he had pledged to enact last year, as a presidential candidate.
Administration lawyers argued in multiple courts on Wednesday that the president was merely exercising his national security powers and that no element of the executive order, as written, could be construed as a religious test for travelers.
But in the lawsuit brought by Hawaii’s attorney general, Doug Chin, Judge Derrick K. Watson appeared skeptical of the government’s claim that past comments by Mr. Trump and his allies had no bearing on the case.
“Are you saying we close our eyes to the sequence of statements before this?” Judge Watson, who was appointed by former President Barack Obama, asked in a hearing Wednesday before he ruled against the administration.
Mr. Trump’s original ban, released on Jan. 27, unleashed scenes of chaos at American airports and spurred mass protests. Issued abruptly on a Friday afternoon, it temporarily barred travel from seven majority-Muslim nations, making no explicit distinction between citizens of those countries who already had green cards or visas and those who did not.
It also suggested that Christian refugees from those countries would be given preference in the future, opening it up to accusations that it unlawfully targeted Muslims for discrimination.
After a federal court in Seattle issued a broad injunction against the policy, Mr. Trump removed major provisions and reissued the order. The new version exempted key groups, like green card and visa holders, and dropped the section that would have given Christians special treatment.
Mr. Trump also removed Iraq from the list of countries covered by the ban after the Pentagon expressed worry that it would damage the United States’ relationship with the Iraqi government in the fight against the Islamic State.
Yet those concessions did not placate critics of the ban, who argue that it still imposes a de facto religious test on travelers from big parts of the Middle East.
The lawsuits have also claimed that the order disrupts the functions of companies, charities, public universities and hospitals that have deep relationships overseas. In the Hawaii case, nearly five dozen technology companies, including Airbnb, Dropbox, Lyft and TripAdvisor, joined in a brief objecting to the travel ban.
The new executive order preserves major components of the original. It halts, with few exceptions, the granting of new visas and green cards to people from six majority-Muslim countries — Iran, Libya, Somalia, Sudan, Syria and Yemen — for at least 90 days. It also stops all refugees from entering for 120 days and limits refugee admissions to 50,000 people in the current fiscal year. Former President Barack Obama had set in motion plans to admit more than twice that number.
Mr. Trump has said the pause is needed to re-evaluate screening procedures for immigrants from the six countries before allowing travel to resume. “Each of these countries is a state sponsor of terrorism, has been significantly compromised by terrorist organizations, or contains active conflict zones,” he wrote in the order, signed March 6.
Jeffrey Wall, a lawyer in the United States solicitor general’s office, said in the Maryland courtroom Wednesday that the order was based on national security concerns raised by the Obama administration in its move toward stricter screening of travelers from the six countries.
“What the order does is a step beyond what the previous administration did, but it’s on the same basis,” Mr. Wall said.
The judge’s order was not a ruling on the constitutionality of Mr. Trump’s ban, and the administration has consistently expressed confidence that courts will ultimately affirm Mr. Trump’s power to issue the restrictions.
But the legal debate is likely to be a protracted and unusually personal fight for the administration, touching Mr. Trump and a number of his key aides directly and raising the prospect that their public comments and private communications will be scrutinized extensively.
Multiple lawsuits challenging the travel ban have extensively cited Mr. Trump’s comments during the presidential campaign. He first proposed to bar all Muslims from entering the United States, and then offered an alternative plan to ban travel from a number of Muslim countries, which he described as a politically acceptable way of achieving the same goal.
The lawsuits also cited Rudolph W. Giuliani, the former New York City mayor who advises Mr. Trump, who said he had been asked to help craft a Muslim ban that would pass legal muster.
And they highlighted comments by Stephen Miller, an adviser to the president, who cast the changes to Mr. Trump’s first travel ban as mere technical adjustments aimed at ushering the same policy past the review of a court.
Bob Ferguson, the Washington attorney general, has indicated that in an extended legal fight, his office could seek depositions from administration officials and request documents that would expose the full process by which Trump aides crafted the ban.
Mr. Trump has reacted with fury to unfavorable court rulings in the past, savaging the judiciary after the court in Seattle blocked major parts of his first travel order and singling out the judge for derision on Twitter.
The opinion of this so-called judge, which essentially takes law-enforcement away from our country, is ridiculous and will be overturned!— Donald J. Trump (@realDonaldTrump) Feb. 4, 2017
The president’s comments were so biting that even his nominee for the Supreme Court, Judge Neil M. Gorsuch, told senators that attacks on the judiciary were “demoralizing.”
A White House spokesman insisted later that Mr. Gorsuch had not been criticizing Mr. Trump specifically.
If Mr. Trump lashes out again at the judiciary, it could set the stage in an uncomfortable way for Mr. Gorsuch’s confirmation hearings, which begin next week.