President Trump holds up a hat that reads “Make Counties Great Again” before signing the Waters of the United States executive order Tuesday in the Roosevelt Room of the White House. (Andrew Harnik/AP)

The Trump administration is finalizing a revised travel ban that exempts current visa holders, according to people familiar with the matter.

The revision marks a significant departure from the now-

frozen first executive order, which temporarily barred citizens of seven majority-Muslim countries and all refugees from entering the United States and resulted in the State Department revoking tens of thousands of visas. Justice Department lawyers hope the new order will be more likely to withstand legal challenges and will not leave any travelers detained at U.S. airports.

The new order also removes an exception to the refu­gee prohibition for religious minorities, one person said. Critics of the order had said that that exception proved the order was meant to discriminate on the basis of religion, because it allowed only Christians into the country.

The new order, the details of which were first reported by the Wall Street Journal, was expected to be signed Wednesday, but the White House canceled that after Trump’s speech Tuesday night.

The people who described it to The Washington Post did so on the condition of anonymity because the administration had not authorized the release of details. The people said that the situation is fluid and that changes are still possible.

There will be a period between when the order is signed and when it takes effect, in hopes of avoiding the problems that occurred when the last order was implemented. While blocking only the issuance of new visas marks a substantial change, analysts have said that this would not necessarily be enough for the order to pass legal muster.

Spokesmen for the White House, Justice Department and Department of Homeland Security declined to comment for this report.

A federal district judge in Washington state first suspended the travel ban Feb. 3, and a three-judge panel of the U.S. Court of Appeals for the 9th Circuit later upheld that freeze. The Justice Department has since asked the courts to hold off on further litigation while a new executive order was crafted, although the Court of Appeals told the parties to press ahead with the case.

While that has been ongoing, refugees as well as people from the seven affected countries have been able to enter the United States subject to normal individual screenings on arrival.

The president has broad authority to set immigration policy, although Trump’s first executive order was implemented in such a way that most judges agreed that the directive — or at least aspects of it — should be suspended. Judges have yet to weigh whether the ban is constitutional. Trump and his top spokesmen have asserted that they feel they are on strong legal footing, despite short-term losses.

The White House counsel already had clarified that the ban did not apply to legal permanent residents, although courts have said they could not rely on that assertion because it was a separate statement and not part of the executive order. Officials hope the new executive order will allay that concern and also reduce the number of plaintiffs who have the right to sue.

Even that, though, might not go far enough. The 9th Circuit panel that ruled the ban should remain frozen said such a revision would not address claims “by citizens who have an interest in specific noncitizens’ ability to travel to the United States.” That, analysts have said, might be referring to the foreign wife of a U.S. citizen who is seeking a visa.

A spokesman for Washington state Attorney General Bob Ferguson, who had successfully sued to freeze the ban, said, “Our current stance is to wait and see the particulars, which could make all the difference.”

Lee Gelernt, the deputy director of the American Civil Liberties Union’s national Immigrants’ Rights Project, who is involved in a separate legal challenge, said, “If the new executive order contains a ban, we believe it is unconstitutional religious discrimination and will therefore continue our legal challenges.”

The administration must also contend with comments the president and top allies and his advisers have made, which could serve as evidence that the ban was intended to discriminate on religious grounds. On the campaign trail, Trump called for a “total and complete shutdown of Muslims entering the United States.” And after the election, former New York City mayor Rudolph W. Giuliani said: “So when [Trump] first announced it, he said, ‘Muslim ban.’ He called me up. He said, ‘Put a commission together. Show me the right way to do it legally.’ ”

A federal judge in Virginia referenced those comments in ordering the ban frozen with respect to Virginia residents and institutions, calling it “unrebutted evidence” that Trump’s directive might violate the First Amendment. That is important, because if judges found that even the new order was designed to discriminate against Muslims — and not to protect national security — they might similarly strike it down.

Justice Department lawyers will have to try to convince judges that there is a national security reason for the ban and that it is not a tool for discrimination. That the new order will not include an exception for religious minorities — which had been seen as a way to get only Christians into the country — is likely to bolster the government’s case, particularly if Justice Department lawyers persuade the judiciary to look mostly at the executive order itself for evidence of the administration’s purpose.

But analysts said the new order cannot wash away completely the stains of the old one — especially after senior policy adviser Stephen Miller said that the revised version would have “mostly minor technical differences” and that Americans would see “the same basic policy outcome for the country.”

And the Department of Homeland Security’s Office of Intelligence and Analysis recently produced a report casting doubt on the need for the executive order, concluding that citizenship of a particular country is an “unreliable” threat indicator and that people from the seven countries named in the original ban have rarely been implicated in U.S.-based terrorism.