OAKLAND (CBS SF) — A federal judge in Oakland on Friday evening blocked part of President Trump’s plan to build a wall on the Mexican border with funds diverted from other military and agency programs.

U.S. District Haywood Gilliam issued a preliminary injunction barring the use of $1 billion diverted from Army pay and pension funds to construct segments of the wall in areas of El Paso, Tex., and Yuma County, Ariz. The construction was scheduled to begin this summer.

READ MORE: San Jose Homicide Suspects Released Without Posting Bail; Cops Tweet 'The System Has Failed'

Gilliam ruled in a lawsuit filed by the Sierra Club and a coalition of southern border groups, represented by American Civil Liberties Union lawyers.

The $1 billion was part of a total of $6.7 billion that Trump in February announced he planned to divert from several agencies after Congress refused to appropriate the $5.7 billion he sought for wall funding. Congress instead granted $1.375 billion.

Gilliam said the $1 billion diversion appeared to violate a budget law that allows the Defense Department to transfer funds among programs to pay for military construction if the need is “unforeseen” and if Congress has not refused to fund the project in question.

The judge wrote that the alleged need did not appear to be unforeseen because the Trump administration made “multiple requests for funding for exactly that purpose dating back to at least early 2018.”

READ MORE: Authorities: Suspect In Walnut Creek Nordstrom Smash-And-Grab Out On Bail; 2nd Suspect Appears In Court

He also said the financial diversion plan “likely would violate the Constitution’s separation of powers principles” by intruding on Congress’s power to set the federal budget.

Gilliam scheduled a June 5 hearing to discuss next steps in the lawsuit and in a similar challenge filed by California and 19 other states.

ACLU attorney Dror Ladin said in a statement, “This order is a win for our system of checks and balances, the rule of law, and border communities.

“The court blocked all the wall projects currently slated for immediate construction,” Ladin said. “If the administration begins illegally diverting additional military funds, we’ll be back in court to block that as well.”

MORE NEWS: Housing Shortage: Inventory Of Single-Family Homes In Santa Clara County Reach Record Low, Realtors Say

© Copyright 2019 CBS Broadcasting Inc. and Bay City News Service. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed