The White House is preparing for a showdown over who will be the next leader of the Consumer Financial Protection Bureau, a high-stakes battle that could end up in court and slow President Trump’s effort to roll back banking industry regulations.

Leadership of the agency, which Trump called a “total disaster” on Twitter Saturday, was thrown into doubt on an otherwise slow holiday weekend after the White House and the CFPB’s outgoing head both named acting directors to head the regulatory watchdog. On Friday, Trump named Mick Mulvaney, a longtime critic of the agency and the Office of Management and Budget director, while Richard Cordray promoted his chief of staff, Leandra English, to deputy director and said she would become acting director.

Both sides appeared to be preparing for a fight Saturday, including wading into the fine print of federal rules to bolster their position. The Justice Department’s Office of Legal Counsel issued an eight-page opinion late in the day supporting Mulvaney’s appointment as temporary head of the agency, while other legal analysts called the move illegal.

“We think the clear legal authority is that the president does have this authority. We’ll find out based on how Ms. English decides to act at the appropriate time,” a senior administration official said in a call with reporters.

In a brief interview Saturday, Cordray disagreed. “The law authorized me to appoint a deputy director, and I did so. My understanding of the law is that the deputy director serves as the acting director upon my resignation. If there are disagreements about these issues, the appropriate place to settle them would be in the courts,” he said.

The battle, should it wind up in court, could turn into a roadblock to the Trump administration’s efforts to roll back financial regulations. While Trump has installed new leadership at the top of several other regulatory agencies, many of which have already taken a more business-friendly tone, the CFPB has continued to aggressively push rules that irked Wall Street. The agency has broad powers to regulate financial firms, from banks, credit card companies to payday lenders, and impose fines for wrongdoing.

The agency has often run afoul of conservatives for what the banking industry has complained is overly aggressive rulemaking. But it has been cheered by consumer advocates and Democrats for taking on big banks, including Wells Fargo, which it fined a record $100 million for opening millions of fake accounts customers didn’t ask for.

“The Consumer Financial Protection Bureau, or CFPB, has been a total disaster as run by the previous Administrations pick. Financial Institutions have been devastated and unable to properly serve the public. We will bring it back to life!,” Trump said of the six-year old agency Saturday. In another tweet, he referred to a Wall Street Journal editorial critical of the agency, and said Cordray had “just quit.”

Still, the agency’s fate remained unclear. “It appears that both Deputy Director English and OMB Director Mulvaney will walk in the door on Monday morning with the expectation of running the CFPB. We haven’t the faintest clue how that specific interaction will unfold, but our sense is that it could be a muddled mess,” Isaac Boltansky, a Washington policy analyst for the investment firm Compass Point Research & Trading, said in a research note Saturday.

The White House has not spoken to English but expects her to show up to work Monday — as deputy director, said administration officials, who spoke on the condition of anonymity to discuss internal deliberations. Mulvaney is working on a transition plan and will serve as the CFPB’s acting director until the Senate confirms a permanent replacement, they said. At the same time, he would remain as budget director.

“We don’t have any reason to think that anything out of the ordinary course will happen,” one senior administration said. “We think [Mulvaney] will show up Monday, and he will go into the office and start working.”

The White House hopes to avoid a legal battle, but is confident that its appointment of Mulvaney will stand up to scrutiny, senior administration officials said in a call with reporters Saturday morning.

“We have gone out of our way to avoid an unnecessary legal battle with Mr. Cordray,” a senior administration official said. “His actions clearly indicate that he is trying to provoke one.”

The tug-of-war over the leadership of the agency is likely to linger for some time. Democrats and consumer advocates say Mulvaney’s appointment is illegal and are calling on the Trump administration to allow English to serve until a permanent replacement is confirmed by the Senate.

Trump “can nominate the next @CFPB Director — but until that nominee is confirmed by the Senate, Leandra English is the Acting Director under the Dodd-Frank Act,” Sen. Elizabeth Warren (D-Mass.), who helped establish the bureau and is one of its biggest supporters, said on Twitter.

Installing Mulvaney, even on a temporary basis, to lead the agency would quickly change its course. As a Republican congressman, Mulvaney called the CFPB a “joke . . . in a sick, sad way” and said it should be dissolved. Mulvaney’s experience running a large agency and time serving on the House Financial Services Committee qualified him for job, administration officials said.

Mulvaney’s appointment has already set off a wave of protest from consumer advocates who fear the former Republican House lawmaker would dismantle the agency. Lauren Saunders, associate director of the National Consumer Law Center, compared Mulvaney’s potential leadership of the agency to installing a “wrecking ball.”

“It is no joke to ordinary families to attempt to defang the one agency in Washington with the tools and independence to take on the Wall Street banks, giant credit reporting agencies, and predatory lenders that abuse the American public,” she said in a statement.

The fight over the agency’s future began Friday when Cordray announced that he was stepping down at midnight, a week earlier than expected, and promoted English to deputy director. In a letter announcing his decision, Cordray cited a section of 2010s Dodd-Frank Act that states a deputy director will “serve as acting director in the absence or unavailability of the director.”

In addition to serving as CFPB’s chief of staff, English has been the agency’s deputy chief operating officer, the principal deputy chief of staff at the Office of Personnel Management, chief of staff and senior adviser to the deputy director for management at the Office of Management and Budget. Her appointment will “ensure a smooth transition and operational stability at the agency,” Rep. Maxine Waters (Calif.), the ranking Democrat on the Financial Services Committee, said in a statement.

The announcement was seen as a maneuver to delay a Trump administration takeover of the agency and a few hours later the White House named Mulvaney acting director. The president’s authority under the Federal Vacancies Reform Act supersedes the language in the Dodd-Frank legislation, administration officials said. “The fact that the Deputy Director may serve as Acting Director by operation of the statute, however, does not displace the President’s authority under the Vacancies Reform Act,” Steven Engel, assistant attorney general, said in a letter released Saturday supporting the decision.

But one of the authors of Dodd-Frank, former congressman Barney Frank (D-Mass.), disputed that the administration’s reading of the law. “It is obvious,” Frank said in an interview. Lawmakers would not have included the succession language in the Dodd-Frank legislation if they intended for the Federal Vacancies Reform Act to supersede it, he said.

“If you look at the CFPB language it is very specific and it was designed to protect an agency that we knew would be under a lot of pressure,” said Frank. “This is an agency that enforces the rules against some of the most powerful financial interests in the country. Everything was structured for its independence.”