NEW YORK (Reuters) - A federal judge in New York ruled on Thursday that the structure of the U.S. Consumer Financial Protection Bureau is unconstitutional, forbidding the agency from suing a company that advances money to people awaiting settlement payouts.

The decision by U.S. District Judge Loretta Preska is at odds with a February ruling by the federal appeals court in Washington that upheld the CFPB’s structure.

Preska said the office of New York Attorney General Barbara Underwood, which joined the CFPB in suing New Jersey-based RD Legal Funding LLC, could continue pursuing the case.

“We will continue to vigorously pursue our case against RD Legal for as many victims as possible,” said Amy Spitalnick, a spokeswoman for the Attorney General’s office.

If another appeals court upholds Preska’s ruling, it could make it more likely that the issue will go to the U.S. Supreme Court.

The CFPB declined to comment.

The CFPB was created as part of the Democrat-backed 2010 Dodd-Frank financial reform law to combat abusive lending. It has been the subject of political and legal battles since U.S. President Donald Trump, a Republican, took office.

Under the leadership of Mick Mulvaney, appointed as the agency’s temporary head in November, the CFPB has shelved new regulations and dropped cases against payday lenders.

“We are pleased that court correctly found that the CFPB is unconstitutional as structured, and this underscores that the CFPB never should have brought this action in the first place,” said David Willingham, a lawyer for RD Legal Funding, in a statement.

Preska said she agreed with a dissenting judge in the Washington case, who found it unconstitutional that the agency was headed by a single director who served a five-year term and could be fired by the president only for cause.

The White House announced earlier this month that Trump would appoint Kathy Kraninger, an Office of Management and Budget official, to succeed Mulvaney as head of the CFPB.

In their lawsuit, filed in February 2017, the CFPB and attorney general claimed RD Legal Funding and related entities used deceptive tactics to scam borrowers, including first responders to the Sept. 11th attacks and National Football League retirees with brain injuries. They said borrowers often ended up paying back twice as much or more than what they received upfront.

Preska ruled Thursday that the attorney general had made plausible claims that RD Legal Funding violated federal and New York law, denying the company’s motion to dismiss the case.