The Trump administration told a federal appeals court Thursday it would rewrite its controversial travel ban targeting several Muslim-majority countries, effectively conceding defeat for now in the new president’s first major confrontation with the federal judiciary.

In a 61-page filing in the Ninth Circuit Court of Appeals, Justice Department lawyers strongly disagreed with a three-judge appellate panel’s decision to keep blocking the order’s enforcement while proceedings continue in a federal district court in Seattle. But the lawyers declined to ask the Ninth Circuit to convene a broader panel to reconsider the three judges’ decision.

“Rather than continuing this litigation, the President intends in the near future to rescind the Order and replace it with a new, substantially revised Executive Order to eliminate what the panel erroneously thought were constitutional concerns,” the Justice Department told the court. “In so doing, the President will clear the way for immediately protecting the country rather than pursuing further, potentially time-consuming litigation.”

It was a sterile, formalistic admission of defeat—at least for now—in a separation-of-powers standoff that had consumed most of the new president’s first month in office. The order’s sudden, haphazard rollout on January 27, one week after President Trump’s inauguration, stranded travelers in airports and sparked protests at major U.S. airports as demonstrators and lawyers demanded their release from custody. Federal judges in multiple states eventually intervened at the request of the ACLU and immigrant-rights groups, blunting the order’s impact in a patchwork archipelago of temporary restraining orders.

The setback came despite sustained criticism from the Trump administration of the rulings; of federal district court judge James Robart, who issued the broadest nationwide injunction against the ruling; of the three-judge panel that upheld Robart’s injunction; of the Ninth Circuit as a whole; and of the federal judiciary. Those critiques ranged from challenges to the courts’ legitimacy to insinuations the judiciary would bear responsibility for future terrorist attacks.

“Just cannot believe a judge would put our country in such peril,” Trump tweeted at one point. “If something bad happens blame him and court system.”

The president echoed those themes during his lengthy Thursday press conference, in which he insisted his presidency was operating like a “fine-tuned machine” and instead claimed it was the Ninth Circuit that was actually adrift. “That circuit is in chaos, and frankly that circuit is in turmoil,” Trump told reporters. He said he had heard the circuit was overturned 80 percent of the time by the Supreme Court—a highly misleading way to measure a court’s performance. (The Supreme Court, by design, reviews lower-court decisions for error or incongruity, not general quality; it also accepts only a handful of the thousands of cases decided by the Ninth Circuit each year.)

The White House did not reveal its plans until its filing Thursday, as it  spent a week weighing whether it should continue to defend the order in the courts or start anew. Neither of its options for appeal seemed likely to succeed. The Trump administration could have asked a broader panel of the Ninth Circuit to reconsider the ruling, but two-thirds of the court’s judges were nominated by Democratic presidents—not a definitive measure of a court’s ideology, but not a heartening one for a Republican president, either. And if the administration asked the U.S. Supreme Court to intervene, five votes from the eight justices would be needed to overturn the panel’s decision. Even if the four justices on the Court’s conservative wing sided with the administration, a fifth vote from its liberal wing could have been difficult to find.

The Ninth Circuit case, Washington v. Trump, is one of more than a dozen lawsuits challenging the ban’s legality across the country. But it quickly became the highest profile case after federal district judge James Robart issued a broad nationwide injunction on February 3 that temporarily barred the federal government from enforcing the order pending further hearings.

Justice Department lawyers quickly sought an emergency stay of Robart’s order from a three-judge appeals panel in the Ninth Circuit. The panel unanimously rejected that request on February 9, ruling that the states of Washington and Minnesota, which filed the lawsuit, had standing to challenge the order on behalf of students and faculty in their public-university systems.

The three judges also indicated the states’ contention that the order violated the Constitution’s due-process protections had a chance of success in the lower courts, although it declined to rule on the merits of those arguments itself. The panel also declined to consider whether the order violated the First Amendment’s religious-freedom protections by targeting Muslim-majority countries.

The federal government, for its part, strongly defended the order’s legality and constitutionality since it was issued on January 27. Administration officials and Justice Department lawyers pointed to the executive branch’s traditionally broad discretion in immigration and national-security matters, as well as a federal statute authorizing the president to suspend the entry of visa holders from certain countries. They also rejected the states’ claims of religious discrimination by noting the order didn’t mention explicitly mention Muslims.

But those arguments made little headway among the federal judiciary. Making the president’s executive order unreviewable by federal courts, the Ninth Circuit panel said, “runs contrary to the fundamental structure of our constitutional democracy.” And in an order-related lawsuit in Virginia, federal judge Leonie Brinkema extensively cited Trump’s previous comments on Muslim immigration when issuing a preliminary injunction against the ban’s enforcement.

The administration hasn’t offered details yet on its next executive order, which President Trump said would be released sometime next week. But the Justice Department did reiterate some arguments in its Thursday filing that will likely resurface in the next generation of legal battles over it.

Central to their brief was the president’s statutory power to exclude classes of foreign nationals from entry, which they cautioned against limiting. “Among other things, it would disable the President from suspending the entry of immigrants from a country with which the United States is on the verge of war,” That provision’s scope went unaddressed by the Ninth Circuit panel’s ruling, even in passing.

But the most interesting portion of the filing dealt with something beyond the order itself. President Trump’s campaign comments on Muslim immigration shaped the public debate of the travel ban, even as he publicly downsized his call for a “total and complete shutdown of Muslims entering the United States” to the opaquer term “extreme vetting” and other euphemisms. The order makes no specific reference to Muslims, of course, but its genealogy is unmistakeable.

The Justice Department, however, urged the Ninth Circuit to look away from those comments. The states’ invocation of them was “profoundly misguided” because it could impose additional judicial constraints on presidents for statements made as private citizens. “That approach, under which the powers of the Presidency would vary based on the identity of the individual duly elected by the people to hold that Office, has no sound basis in precedent and would raise significant separation-of-powers concerns,” they wrote.

But their warnings could be too late. As Vox’s Dara Lind noted last week, those comments could haunt the travel ban’s constitutionality in any iteration. The states cited Supreme Court religious-freedom precedents in which government officials’ statements could be used as evidence of discrimination when reviewing ostensibly neutral laws. And at least one federal judge has shown a willingness to use those precedents against the Trump administration.

Many of the executive order’s flaws can be ironed out with more thorough review by the Justice Department. The president’s own words, however, could be a stain that may be impossible to wash away.