In a blow to the White House, a federal judge issued a pair of rulings late Friday blocking the Trump administration from using billions of dollars in military funds to construct the southern border wall.

The move by Oakland-based Judge Haywood Gilliam Jr. of the Northern District of California halts a total of $2.5 billion in funds and stops construction in sites in New Mexico, California, Arizona and Texas.

The Trump administration planned to break ground on the sites Monday, Bloomberg reported.

President Donald Trump “reprogrammed” military funds to wall construction after declaring an emergency at the border earlier this year — even though he announced publicly he didn’t really “need to do this,” but wanted to speed up construction.

The move was challenged by a lawsuit filed by the America Civil Liberties Union on behalf of the Sierra Club and the Southern Border Communities Coalition. It argued that Trump’s emergency declaration was “made solely out of disagreement with Congress” on funding — and that the wall would be devastating to the environment. Another suit to block the construction was filed by 19 states led by California.

Gilliam said the government presented no new arguments answering his previous concerns when he issued a temporary injunction last month. He then cited Congress’ “absolute” control over federal expenditures under the Constitution, “even when that control may frustrate the desires of the executive branch.” The action by the Trump administration “does not square with fundamental separation of powers principles dating back to the earliest days of our Republic,” the judge wrote then.

He also noted that Trump’s emergency declaration was undercut by the fact that the government had failed to spend all available border funds the previous year.

He found Friday that the plaintiffs would suffer “irreparable harm” from border wall construction because it “will harm their ability to recreate in and otherwise enjoy public land along the border.”

Dror Ladin, an attorney with the ACLU who argued for the injunction in court, said in a statement that the decision “upholds the basic principle that the president has no power to spend taxpayer money without Congress’ approval.”

Gloria Smith, the managing attorney for the Sierra Club, applauded the court’s decision to “protect our Constitution, communities, and the environment.”

“Walls divide neighborhoods, worsen dangerous flooding, destroy lands and wildlife, and waste resources that should instead be used on the infrastructure these communities truly need,” Smith said.

California Attorney General Xavier Becerra said that all “President Trump has succeeded in building is a constitutional crisis, threatening immediate harm to our state.”

There was no immediate comment from Trump or the Department of Justice.