(CNN) The Trump administration doesn't have the authority to divert Pentagon funds to construct additional barriers on the US-Mexico border, a federal appeals court ruled Friday, days after President Donald Trump's visit to a section of the wall in Arizona.
In a 2-1 ruling, the 9th US Circuit Court of Appeals said that the transfer of $2.5 billion circumvented Congress, which holds the authority to appropriate money.
The legal fight over Defense Department funds stems from Trump's national emergency declaration on the US-Mexico border last year. Trump extended the declaration this past February, even as border arrests began to decline.
"The Executive Branch lacked independent constitutional authority to authorize the transfer of funds," wrote Chief Circuit Judge Sidney Thomas for the majority. "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."
While Friday's ruling is a win for the environmental groups and states challenging the use of military funds, a Supreme Court stay, issued last year that allows the funds to be used, remains in effect for the time being.
The American Civil Liberties Union applauded Friday's ruling. "President Trump's xenophobic wall is already leveling protected lands, desecrating cultural sites, and destroying wildlife," said Dror Ladin, staff attorney with the ACLU's National Security Project. "There's no undoing the damage that's been done, but we will be back before the Supreme Court to finally put a stop to this destructive wall."
Three years into his presidency, Trump has faced a host of legal challenges over his border wall and his attempt to bolster the effort with additional funds from other government accounts.
Still, the President has touted progress of his border wall. The administration billed Trump's first 2020 trip to the border this week as a celebration of the completion of 200 miles of new wall system.
"My administration has done more than any administration in the history to secure our southern border. Our border has never been more secure," he told officials. The administration has said it intends to build 450 miles by the end of the year.
Last summer, the Supreme Court cleared the way for the Trump administration to use $2.5 billion from the Pentagon to construct parts of a wall along the southwestern border.
The decision allowed the Defense Department money to be spent now while the court battle played out over whether the government had the authority to divert funds that were not appropriated for the wall. The Supreme Court voted 5-4, along ideological lines, to allow the funds to be used while the court appeals proceed.
The departments of Justice and Homeland Security did not immediately respond to a request for comment.