Updated

A federal judge has blocked President Donald Trump from building key sections of his border wall with money secured under his declaration of a national emergency, delivering what may prove a temporary setback on one of his highest priorities.

U.S. District Judge Haywood Gilliam Jr.'s order, issued Friday, prevents work from beginning on two of the highest-priority, Pentagon-funded wall projects — one spanning 46 miles (74 kilometers) in New Mexico and another covering 5 miles (8 kilometers) in Yuma, Arizona.

On Saturday, Trump pledged to file an expedited appeal of the ruling.

Trump, who is visiting Japan, tweeted: "Another activist Obama appointed judge has just ruled against us on a section of the Southern Wall that is already under construction. This is a ruling against Border Security and in favor of crime, drugs and human trafficking. We are asking for an expedited appeal!"

While Gilliam's order applied only to those first-in-line projects, the judge made clear that he felt the challengers were likely to prevail at trial on their argument that the president was wrongly ignoring Congress' wishes by diverting Defense Department money.

"Congress's 'absolute' control over federal expenditures_even when that control may frustrate the desires of the Executive Branch regarding initiatives it views as important_is not a bug in our constitutional system. It is a feature of that system, and an essential one," he wrote in his 56-page opinion.

It wasn't a total defeat for the administration. Gilliam, an Oakland-based appointee of President Barack Obama, rejected a request by California and 19 other states to prevent the diversion of hundreds of millions of dollars in Treasury asset forfeiture funds to wall construction, in part because he felt they were unlikely to prevail on arguments that the administration skirted environmental impact reviews.

The delay may be temporary. The question for Gilliam was whether to allow construction with Defense and Treasury funds while the lawsuits brought by the American Civil Liberties Union and the state attorneys general were being considered. The cases still must be heard on their merits.

"This order is a win for our system of checks and balances, the rule of law, and border communities," said Dror Ladin, an attorney for the ACLU, which represented the Sierra Club and the Southern Border Communities Coalition.

The Justice Department did not immediately respond to a request for comment late Friday.

The administration faces several lawsuits over the emergency declaration but only one other seeks to block construction during the legal challenge. A judge in Washington, D.C., on Thursday heard arguments on a challenge brought by the U.S. House of Representatives that says the money shifting violates the constitution. The judge was weighing whether the lawmakers even had the ability to sue the president instead of working through political routes to resolve the bitter dispute.

At stake is billions of dollars that would allow Trump to make progress in a signature campaign promise heading into his campaign for a second term.

Trump declared a national emergency in February after losing a fight with the Democratic-led House that led to a 35-day government shutdown. As a compromise on border and immigration enforcement, Congress set aside $1.375 billion to extend or replace existing barriers in Texas' Rio Grande Valley, the busiest corridor for illegal crossings.

Trump grudgingly accepted the money, but then declared the national emergency to siphon money from other government accounts, identifying up to $8.1 billion for wall construction. The funds include $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.

The Defense Department has already transferred the counterdrug money. Patrick Shanahan, the acting defense secretary, is expected to decide any day whether to transfer the military construction funds.

The president's adversaries say the emergency declaration was an illegal attempt to ignore Congress, which authorized far less wall spending than Trump wanted. The administration said Trump was protecting national security as unprecedented numbers of Central American asylum-seeking families arrive at the U.S. border.

The administration has awarded 11 wall contracts for a combined $2.76 billion — including three in the last two months that draw on Defense Department counterdrug money — and is preparing for a flurry of construction that the president is already celebrating at campaign-style rallies.

The Army Corps of Engineers recently announced several large contacts with Pentagon funding. Last month, SLSCO Ltd. of Galveston, Texas, won a $789 million award to replace 46 miles (74 kilometers) of barrier in New Mexico — the one that Gilliam blocked on Friday.

Last week, Southwest Valley Constructors of Albuquerque, New Mexico, won a $646 million award to replace 63 miles (101 kilometers) in the Border Patrol's Tucson, Arizona, sector, which Gilliam did not stop. Barnard Construction Co. of Bozeman, Montana, won a $141.8 million contract to replace 5 miles (8 kilometers) in Yuma that Gilliam blocked and 15 miles (24 kilometers) in El Centro, California, which he did not address.

Gilliam's ruling gives a green light — at least for now — for the administration to tap the Treasury funds, which it has said it plans to use to extend barriers in Rio Grande Valley.

California Attorney General Xavier Becerra, a Democrat and frequent Trump adversary, didn't comment directly on his defeat but congratulated the ACLU and its clients "in securing this critical victory for our states and communities."

Trump inherited barriers covering 654 miles (1,046 kilometers), or about one-third of the border with Mexico. Of the 244 miles (390 kilometers) in awarded contracts, more than half is with Pentagon money. All but 14 miles (22 kilometers) awarded so far are to replace existing barriers, not extend coverage.

___

Spagat reported from San Diego.