WASHINGTON/NEW YORK (Reuters) - A federal appeals court ruled on Tuesday that the structure of the U.S. agency charged with guarding consumers’ finances is unconstitutional, fueling an election-year political fight over one of the signature government responses to the 2007-09 financial crisis.

The U.S. Court of Appeals for the District of Columbia Circuit threw out a $109 million penalty against PHH Corp in 2014, saying the structure of the Consumer Financial Protection Bureau gives its sole director too much power.

The three-judge panel, though, also sought to remedy the problem by giving the president the power to fire the director, which it said made the position similar to the Attorney General and other constitutionally sanctioned agency heads who answer to the White House.

“The CFPB has dodged the biggest bullet, which is to be declared unconstitutional and have all its prior rules and regulations voided,” said Andrew Sandler, chairman of BuckleySandler law firm.

But he added “lawyers will be looking hard,” at past agency decisions.

The CFPB is expected to request the entire appeals court conduct an “en banc” review of the case. The losing side will likely appeal to the Supreme Court.

The ruling will affect other lawsuits against the agency in lower courts, but should not affect the government’s $190 million settlement last month of fraud charges with Wells Fargo & Co. The CFPB was involved in that case.

PHH had objected to the CFPB’s allegations it violated the Real Estate Settlement Procedures Act by referring customers to mortgage insurers who in turn bought reinsurance from one of its units.

The judges ruled the lender was within the law and also that the CFPB was wrong to say its administrative action did not need to respect a three-year statute of limitations on the alleged violations.

U.S. Circuit Judge Brett Kavanaugh wrote the current CFPB structure “poses a far greater risk of arbitrary decision making and abuse of power, and a far greater threat to individual liberty, than does a multi-member independent agency.”

The 2010 Dodd-Frank Wall Street reform law created the bureau in response to abuse of borrowers that preceded the financial crisis. Republicans objected to a clause in the law that the director could only be fired “for cause” and they foiled President Barack Obama’s first choice of CFPB director, now Senator Elizabeth Warren.

Obama appointed Richard Cordray director while Congress was in recess. Republicans have introduced legislation to put a commission in charge of CFPB and have Congress appropriate its funding. Currently, the Federal Reserve backs the agency.

Democrats say those changes would destroy the agency’s independence. They also worry that if Republican Donald Trump wins November’s presidential election, the billionaire will tell Cordray, “you’re fired,” and appoint a head who brings the agency’s work to a halt.

Members of both parties released a torrent of tweets and statements on Tuesday’s court ruling.

Republican Jeb Hensarling, who chairs the House Financial Services Committee, called CFPB “the most powerful and least accountable Washington bureaucracy in American history.”

Warren said “the ruling makes a small, technical tweak to Dodd-Frank and does not question the legality of any other past, present, or future actions of the CFPB.” She called Republican reorganization efforts “attempts fostered by big banks to cripple an agency.”

The decision is likely to lead more companies to challenge the CFPB’s enforcement actions in the future, said Ballard Spahr attorney Alan Kaplinsky, who closely follows the bureau.

PHH said in a statement that it hoped “the court’s opinion will provide greater certainty to the entire mortgage industry.”

(Corrects spelling in 4th paragraph to BuckleySandler law firm)