A federal appeals court in Washington sided with House Democrats on Friday in their effort to block the Trump administration’s diversion of billions of dollars to build the president’s signature southern border wall.

The U.S. Court of Appeals for the D.C. Circuit unanimously backed Congress’s power of the purse and said House lawmakers could proceed with their lawsuit alleging it was illegal for President Trump to transfer the money for the wall.

The Constitution gives Congress spending authority, the court said, and it “requires two keys to unlock the Treasury, and the House holds one of those keys. The Executive Branch has, in a word, snatched the House’s key out of its hands,” according to the opinion from Judge David B. Sentelle, who was joined by Judges Patricia A. Millett and Robert L. Wilkins.

House Democrats went to court claiming Trump violated the Constitution by ignoring congressional spending limits and diverting more than $6 billion allocated for other purposes to fund the wall at the border with Mexico. The administration invoked statutes it said allowed the president to repurpose appropriations.

In a separate border wall case, the Supreme Court in July rejected an effort by environmentalists to stop ongoing construction of parts of the president’s border wall.

The D.C. Circuit panel on Friday said the Trump administration had essentially cut the House out of the appropriations process “rendering for naught” its vote to withhold border wall funding. The judges also rejected the Justice Department’s argument that the House cannot go to court to protect its interests without consent of the Senate.

“The ironclad constitutional rule is that the Executive Branch cannot spend until both the House and the Senate say so,” according to Sentelle’s opinion. “Unlike the affirmative power to pass legislation, the House can wield its appropriations veto fully and effectively all by itself, without any coordination with or cooperation from the Senate.”

Sentelle was nominated by President Ronald Reagan. Millett and Wilkins were nominated by President Barack Obama.

House Speaker Nancy Pelosi hailed the court’s decision.

“On a bipartisan basis, Congress has repeatedly refused to fund the President’s immoral, ineffective and wasteful border wall,” she said in a statement. “The House of Representatives is committed to upholding our authority as the first branch of government to ensure that funds appropriated by Congress for these vital initiatives are used as directed.”

In August, the full D.C. Circuit held that a single house of Congress did have standing to pursue litigation against the administration and sent the case back to the three-judge panel to consider other aspects of the administration’s challenge to the House’s claims.

The three-judge panel was reviewing a 2019 decision from District Court Judge Trevor McFadden, a Trump nominee, who held that the House lacked legal grounds or standing to bring the lawsuit.

The ruling Friday is unlikely to be the final word in the controversy. The Justice Department did not respond to a request for comment.