FILE - In this Feb. 5, 2019 file photo, Border Patrol agent Vincent Pirro walks towards prototypes for a border wall in San Diego. An appeals court has upheld a freeze on Pentagon money to build a border wall with Mexico, casting doubt on President Donald Trump's ability to make good on a signature campaign promise before the 2020 election. (AP Photo/Gregory Bull, File)

FILE - In this Feb. 5, 2019 file photo, Border Patrol agent Vincent Pirro walks towards prototypes for a border wall in San Diego. An appeals court has upheld a freeze on Pentagon money to build a border wall with Mexico, casting doubt on President Donald Trump's ability to make good on a signature campaign promise before the 2020 election. (AP Photo/Gregory Bull, File)

SAN DIEGO (AP) — An appeals court on Wednesday upheld a freeze on Pentagon money to build a border wall with Mexico, casting doubt on President Donald Trump’s ability to make good on a signature campaign promise before the 2020 election.

A divided three-judge panel of the 9th U.S. Circuit Court of Appeals in San Francisco agreed with a lower court ruling that prevented the government from tapping Defense Department counterdrug money to build high-priority sections of wall in Arizona, California and New Mexico.

The decision is a setback for Trump’s ambitious plans. He ended a 35-day government shutdown in February after Congress gave him far less than he wanted. He then declared a national emergency that the White House said would free billions of dollars from the Pentagon.

ADVERTISEMENT

The case may still be considered, but the administration cannot build during the legal challenge.

“As for the public interest, we conclude that it is best served by respecting the Constitution’s assignment of the power of the purse to Congress, and by deferring to Congress’s understanding of the public interest as reflected in its repeated denial of more funding for border barrier construction,” wrote Judges Michelle Friedland, a Barack Obama appointee, and Richard Clifton, a George W. Bush appointee.

A freeze imposed by U.S. District Judge Haywood Gilliam Jr. of Oakland in May prevented work on two Pentagon-funded wall contracts — one spanning 46 miles (74 kilometers) in New Mexico and another covering 5 miles (8 kilometers) in Yuma, Arizona.

While the order applied only to those first-in-line projects, Gilliam made clear that he felt the American Civil Liberties Union was likely to prevail in their argument that Trump ignored Congress’ wishes by diverting Defense Department money.

Gilliam went a step further Friday by ruling definitively that the administration couldn’t use Pentagon counterdrug money for the two projects covered in his May order or to replace 63 miles (101 kilometers) in the Border Patrol’s Tucson, Arizona, sector and 15 miles (24 kilometers) in its El Centro, California, sector.

The administration immediately appealed.

N. Randy Smith, a George W. Bush appointee, strongly disagreed with the appeals court ruling, saying it misread constitutional separation of powers.

ADVERTISEMENT

“The majority here takes an uncharted and risky approach — turning every question of whether an executive officer exceeded a statutory grant of power into a constitutional issue,” he wrote in his dissent. “This approach is in contradiction to the most fundamental concepts of judicial review.”

The Justice Department didn’t immediately respond to a request for comment Wednesday. Its attorneys argued that the freeze on Pentagon funds showed a “fundamental misunderstanding of the federal appropriations process.”

The ACLU, which represented the Sierra Club and Southern Border Communities Coalition, applauded the decision.

“For the sake of our democracy and border communities, it’s time the president come to terms with the fact that America rejected his xenophobic wall — and move on,” said ACLU attorney Dror Ladin.

At stake is billions of dollars that would allow Trump to make progress on a major 2016 campaign promise heading into his race for a second term.

Trump declared a national emergency after losing a fight with the Democratic-led House that led to the 35-day shutdown. Congress agreed to spend nearly $1.4 billion on barriers in Texas’ Rio Grande Valley, the busiest corridor for illegal crossings, which was well below the $5.7 billion the president requested.

Trump grudgingly accepted the money but declared the emergency to siphon cash from other government accounts, finding up to $8.1 billion for wall construction. The money includes $3.6 billion from military construction funds, $2.5 billion from Defense Department counterdrug activities and $600 million from the Treasury Department’s asset forfeiture fund.

Acting Defense Secretary Mark Esper has yet to approve transferring the military construction funds. The Treasury Department funds have so far survived legal challenges.

The president’s adversaries say the emergency declaration was an illegal attempt to ignore Congress.

The administration said the U.S. needed emergency protection to fight drug smuggling. Its arguments did not mention illegal immigration or unprecedented numbers of Central American families seeking asylum at the U.S. border , which have dominated public attention in recent months.

The administration has awarded $2.8 billion in contracts for barriers covering 247 miles (390 kilometers), with all but 17 miles (27 kilometers) of that to replace existing barriers not expand coverage. It is preparing for a flurry of construction that the president is already celebrating at campaign-style rallies.

Trump inherited barriers spanning 654 miles (1,046 kilometers), or about one-third of the border with Mexico. Of the miles covered under Trump-awarded contracts, more than half is with Pentagon money.

The Army Corps of Engineers recently announced several large Pentagon-funded contacts.

SLSCO Ltd. of Galveston, Texas, won a $789 million award to replace the New Mexico barrier. Southwest Valley Constructors of Albuquerque, New Mexico, won a $646 million award for the work in Tucson. Barnard Construction Co. of Bozeman, Montana, won a $141.8 million contract to replace barrier in Yuma and El Centro.