In a loss for the Trump administration, an appeals court on Monday upheld a lower court ruling disqualifying Alina Habba from her position as acting U.S. attorney for the District of New Jersey.

In a 32-page ruling, the 3rd Circuit Court of Appeals found that Habba’s appointment violates the Federal Vacancies Reform Act.

Judge Michael Fisher wrote for the three-judge panel, “It is apparent that the current administration has been frustrated by some of the legal and political barriers to getting its appointees in place,” saying that the steps it took to install Habba run afoul of the law.

The decision stems from a motion from Julien Giraud Jr., a New Jersey man who faced drug trafficking and firearm charges that predated Habba’s appointment. Giraud moved to dismiss his indictment on July 27, arguing that President Donald Trump’s appointment of Habba, who had been overseeing the case, was unlawful.

He pleaded not guilty. The court did not dismiss Giraud’s underlying criminal case.

The White House referred a request for comment to the Justice Department, which did not immediately respond. The New Jersey U.S. attorney’s office did not immediately respond to a request for comment.

Habba is a former personal lawyer to the president.

A federal judge ruled in August that Habba’s appointment was “unlawful,” though the judge’s order was on hold as the legal proceedings continued in an appeals court.

In the summer ruling, U.S. District Judge Matthew W. Brann took issue with Trump naming Habba as interim U.S. attorney in March, a position that is time-limited to 120 days. He said in his ruling that while Trump nominated her in June to serve as the permanent attorney, the Senate did not take up her nomination.

Weeks after Trump nominated her to the permanent position, judges for the U.S. District Court of New Jersey appointed her deputy to be the new U.S. attorney. In response, Attorney General Pam Bondi fired the deputy, appointed Habba as “Special Attorney to the Attorney General” with all the powers of the U.S. attorney, and then appointed her to the deputy position, which allowed her to become the acting U.S. attorney again.

The appeals court found that Bondi can’t delegate all the power of the office to Bondi with the special attorney appointment.

“This delegation theory would create a means for the Department of Justice to circumvent the FVRA’s exclusivity provision, effectively permitting anyone to fill the U.S. Attorney role indefinitely. This should raise a red flag,” the ruling said.

The appeals court’s decision comes just days after a federal judge dismissed criminal indictments against former FBI Director James Comey and New York Attorney General Letitia James after finding that acting U.S. Attorney Lindsey Halligan, who was prosecuting the cases, was unlawfully appointed.

U.S. District Judge Cameron Currie said last month that Halligan, another former Trump lawyer with no prior prosecutorial experience, “had no lawful authority to present the indictment.”

The administration has said it will appeal that ruling as well.

Dareh Gregorian, Chloe Atkins, Ryan J. Reilly, Michael Kosnar and Gabe Gutierrez contributed.