A federal appeals court on Friday ruled that the Trump administration acted unlawfully when it transferred $2.5 billion in military construction projects to build parts of the wall at the southern border -- a blow to the administration’s efforts to fulfill President Trump’s signature 2016 campaign promise.

The 9th Circuit Court of Appeals ruled 2-1 that the administration illegally went around Congress in reappropriating the funds. It ruled on a suit brought by a coalition of border states including California and environmental groups.

TRUMP TOURS WALL AS CONSTRUCTION HITS 200-MILE MARK, SAYS SOUTHERN BORDER HAS 'NEVER BEEN MORE SECURE' 

“The panel affirmed the district court’s judgment holding that budgetary transfers of funds for the construction of a wall on the southern border of the United States in California and New Mexico were not authorized under the Department of Defense Appropriations Act of 2019,” the ruling said.

The court concluded that “… the Executive Branch lacked independent constitutional authority to transfer the funds at issue here” and that therefore “the transfer of funds was unlawful.”

BORDER WALL PROGRESS: WHAT'S BEEN BUILT SO FAR?

"The panel noted that the Appropriations Clause of the U.S. Constitution exclusively grants the power of the purse to Congress. The panel held that the transfer of funds violated the Appropriations Clause, and, therefore, was unlawful."

The court also ruled that the government was not in compliance with environmental regulations, and was therefore harming those who visit the region for nature-related activities including bird-watching and would also disturb wildlife.

“We are sorely disappointed in this decision,” DHS spokeswoman Alexei Woltornist said.

The administration had shifted money over after Trump declared a national emergency along the border amid the 2019 border crisis.

CLICK HERE TO GET THE FOX NEWS APP

The Supreme Court, in a ruling last year, had allowed the money to be spent while litigation continued. It is expected that states and private advocacy groups will now go back to the Supreme Court and request it revise its earlier order allowing the funds to be used.

Trump visited wall construction in Yuma, Ariz., on Tuesday where he marked more than 200 miles of wall being built since he took office in 2017.

Fox News' John Roberts and The Associated Press contributed to this report.