Updated

A federal judge on Friday temporarily blocked the Trump administration's plan to spend billions to construct a wall on the U.S.-Mexico border with Defense Department funds.

U.S. District Court Judge Haywood Gilliam’s ruling halts the administration from using the reallocated funds for projects in specific areas in Texas and Arizona. Trump declared a national emergency in February to redirect funding from the Department of Defense to begin construction of his long-promised border wall.

“In short, the position that when Congress declines the Executive’s request to appropriate funds, the Executive nonetheless may simply find a way to spend those funds “without Congress” does not square with fundamental separation of powers principles dating back to the earliest days of our Republic,” wrote Gilliam, who was appointed to the bench by former President Barack Obama.

In this Nov. 21, 2018, file photo, two Honduran men pose as a photographer, at left, takes their picture after the group climbed the border wall separating Tijuana, Mexico, and San Diego, before climbing back down on the Mexican side, seen from San Diego. (AP Photo/Gregory Bull, File)

THAT LOOSE CHANGE LEFT AT AIRPORTS MAY BE USED TO HELP FUND BORDER OPERATIONS

The move was a workaround Congress, which had not given in to his demands to fund the barrier. The wall has been Trump's signature promise. Gilliam's ruling doesn't prevent the Trump administration from using other sources to fund the wall.

He said Trump's plan to divert Pentagon funds for border-wall construction was unconstitutional because the argument White House relied on applied to unforeseen needs, Politico reported.

“Defendants’ argument that the need for the requested border barrier construction funding was ‘unforeseen’ cannot logically be squared with the Administration’s multiple requests for funding for exactly that purpose dating back to at least early 2018,” the Obama nominee wrote.

The Justice Department did not immediately respond to a Fox News request for comment.

Trump declared the national emergency after a stand-off between him and Democrats over border wall funding resulted in the 35-day partial government shutdown.

Around 20 states, environmental groups and civil liberties groups sued the administration to halt plans for the wall.

CLICK HERE TO GET THE FOX NEWS APP

“This order is a win for our system of checks and balances, the rule of law, and border communities,” Dror Ladin, an attorney for the American Civil Liberties Union's National Security Project, said in a statement. “The court blocked all the wall projects currently slated for immediate construction. If the administration begins illegally diverting additional military funds, we'll be back in court to block that as well.”

The ACLU filed a motion on behalf of the Sierra Club and the Southern Border Communities Coalition to block wall construction.

This is a developing story. Check back with Fox News for updates.