Donald Trump has named his Office of Management and Budget Director Mick Mulvaney the acting head of the Consumer Finance Protection Bureau in what’s bound to be a major showdown over the agency’s future. It’s a bureau that Mulvaney once derided as a “joke.”

It also sets up a battle over who has the right to name an interim director of the consumer agency: Trump or Obama-era banking regulator Richard Cordray, who announced he was leaving his post as the head of the CFPB by the end of the day Friday.

In a challenge to the president, Cordray named his own chief of staff Leandra English as deputy director of the agency before stepping down in a move seen as a strategy to protect the agency and thwart efforts by Trump to weaken the CFPB, Politico reported. The deputy director is meant to serve as an interim head until a permanent head is confirmed, according to the Dodd-Frank Act, the legislation that created the agency in 2010 to help protect consumers from a repeat of the subprime mortgage debacle and other banking infractions.

In a note to his staff, Cordray said, “Upon my departure, [English] will become the acting Director pursuant to section 1011(b)(5) of the Dodd-Frank Act.”

Trump is using his powers under the Federal Vacancies Reform Act which allows a president to name someone already in the administration as a temporary director. The conflict could set up a lengthy legal battle over who can run the CFPB until a permanent head is confirmed.

Mulvaney will remain as head of OMB in addition to being interim head of the CFPB.

Republicans have long complained that the CFPB is too independent and too hard on the banking industry. The head of the agency serves for five years and can only be ousted for cause. In addition, the CFPB is funded by the Federal Reserve and not Congress.

“The president looks forward to seeing Director Mulvaney take a common sense approach to leading the CFPB’s dedicated staff, an approach that will empower consumers to make their own financial decisions and facilitate investment in our communities,” the White House said in a statement.

In his resignation letter Friday, Cordray said that the agency “has stood on the side of consumers to see that they are treated fairly, worked to improve their financial situations and held financial institutions accountable.” The CFPB was responsible for levying a $100 million fine against Wells Fargo last year after the bank created millions of fake accounts under consumers’ names.

According to rumors, Cordray, a Democrat, may be preparing to run for the governorship of Ohio, the Los Angeles Times reports.

Here is Richard Cordray's resignation letter to Donald Trump, effective COB today. pic.twitter.com/OsNad0VtY1 — Pete Schroeder (@peteschroeder) November 24, 2017