U.S. District Judge Haywood Gilliam on Friday night delivered a massive blow to President Donald Trump's plan to reallocate funds from the Defense Department to construct the highly-anticipated wall along America's southern border. Judge Gilliam, an Obama appointee, turned his previous temporary injunction into a permanent injunction, which barred the Trump administration from building the wall in California, Arizona, New Mexico and Texas.

President Trump declared a national emergency this year and redirected $6 billion from the Defense Department's various projects to build the border wall. Friday's ruling specifically blocks the administration from using $2.5 billion in military funds for the wall.

“Congress considered all of defendants’ proffered needs for border barrier construction, weighed the public interest in such construction against defendants’ request for taxpayer money, and struck what it considered to be the proper balance — in the public’s interest — by making available only $1.375 billion in funding, which was for certain border barrier construction not at issue here,” the judge said in his ruling.

The lawsuit was brought about by the American Civil Liberties Union (ACLU) and the Sierra Club. According to the groups, President Trump didn't have the power to reallocate funds under a national emergency declaration. The Trump administration, however, said the need for military spending was "unforeseen," which makes the funding legal under an emergency declaration, The Hill reported.

"Because no new factual or legal arguments persuade the court that its analysis in the preliminary injunction order was wrong, [the groups’] likelihood of success on the merits has ripened into actual success," Gilliam said in his ruling.

Both plaintiffs were happy with the decision.

“Congress was clear in denying funds for Trump’s xenophobic obsession with a wasteful, harmful wall," ACLU attorney Dror Ladin said in a statement. "This decision upholds the basic principle that the president has no power to spend taxpayer money without Congress’ approval."

“We've seen the damage that the ever-expanding border wall has inflicted on communities and the environment for decades," Gloria Smith, the managing attorney for the Sierra Club, said in a statement. "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.”