Office of Management and Budget Director Mick Mulvaney arrives to speak to the media at the U.S. Consumer Financial Protection Bureau in November 2017. (Joshua Roberts/Reuters)

A U.S. appeals court on Wednesday ruled that the structure of the Consumer Financial Protection Bureau is constitutional and that its director can be fired by the president for cause only.

The split decision by the U.S. Court of Appeals for the District of Columbia Circuit is a blow to the Trump administration, as well as longtime Republican and financial industry critics of the agency who have argued that the CFPB’s powers need to be reined in.

“We find no reason in constitutional precedent, history, or principle to invalidate the CFPB’s independence,” according to the 68-page majority opinion written by Judge Cornelia T.L. Pillard that was joined by five other judges who concurred in the ruling.

The independent structure of the CFPB has long been at the center of a fierce partisan debate over the agency, which was created during the Obama administration in response to the global financial crisis. The CFPB is ruled by a single director rather than a multi-member commission and gets its funding from the Federal Reserve rather than Congress. The CFPB’s supporters say that structure gives the agency needed independence from political and financial pressures. But Republicans complained it has made the CFPB a rogue, unaccountable force.

“There is nothing constitutionally suspect about the CFPB’s leadership structure. . . . And there is no reason to assume an agency headed by an individual will be less responsive to presidential supervision than one headed by a group,” Pillard said.

The case revolves around a $109 million fine the CFPB levied against PHH Mortgage in 2015 for allegedly giving kickbacks to mortgage insurers in exchange for customer referrals. The New Jersey company sued, saying the penalty showed the agency had too much unchecked authority and that it should be easier for the president to fire its director.

Last year, a federal appeals court sided with PHH and called the structure of the agency unconstitutional. But that ruling was later vacated, and now the U.S. Court of Appeals for the District of Columbia Circuit has sided with the agency’s supporters.

“It’s a great decision,” Richard Cordray, the agency’s former director, said about the appeals court decision. “It rejects some extreme theories to stop independent agencies from engaging in meaningful law enforcement. It is a good day for America.”

Three judges on the appeals court panel disagreed with the decision. “The CFPB’s concentration of enormous power in a single unaccountable, unchecked Director poses a far greater risk of arbitrary decision-making and abuse of power, and a far greater threat to individual liberty, than a multi member independent agency does,” Judge Brett M. Kavanaugh said in an dissenting opinion.

PHH did come out on top on one issue: The appeals court found that the CFPB made errors when it penalized PHH $109 million. That “should dramatically reduce — if not completely eliminate — the company’s enforcement liability,” Jaret Seiberg, an analyst with Cowen and Co.’s Washington Research Group, said in a research note. “We expect Trump’s CFPB will use this decision as a reason to reassess existing [similar] enforcement actions.”

Referring that portion of the decision, PHH said in a statement that it was “an important and gratifying outcome for PHH and the industry” and that it continues to believe it followed the law. But the mortgage company did not indicate whether it planned to appeal the larger ruling.

The Justice Department said it was disappointed by the decision. Last year, the department led by Attorney General Jeff Sessions reversed course from the Obama administration and sided with PHH, arguing that it should be easier for President Trump to fire the head of the CFPB. “We are disappointed in the decision and are reviewing our options,” a Justice Department official said.

A CFPB spokesman said the agency was analyzing the decision.

The ruling offers some stability to an agency that is still caught in a legal tug-of-war over its leadership. Late last year, the agency’s longtime director, Cordray, stepped down and named his former chief of staff, Leandra English, acting director. But just hours later, the White House appointed Mick Mulvaney, the director of the Office of Management and Budget, to the job. English is contesting Mulvaney’s position in court.

In a statement, Sen. Sherrod Brown (D-Ohio), top Democrat of the Banking Committee, applauded the appeals court decision but said that “the CFPB cannot be fully independent until it has a lawfully appointed leader in place. This Administration should quickly nominate a Director with bipartisan support and a track record of holding Wall Street accountable.”

Rep. Jeb Hensarling (R-Tex.), chair of the Financial Services Committee and a fierce CFPB critic, said he hoped the matter would be resolved by the Supreme Court, but also found a silver lining. “In the meantime, I take great solace in the fact that Mick Mulvaney can use his unchecked, unilateral powers to continue the agency’s transformation,” Hensarling said.