WASHINGTON (Reuters) - A federal judge on Tuesday issued a permanent injunction barring President Donald Trump’s attempt to transfer $3.6 billion in military construction funds to build a wall on the U.S.-Mexico border.

FILE PHOTO: A section of border fence is pictured by the U.S.-Mexico border in the Rio Grande Valley near Hidalgo, Texas, U.S., October 7, 2019. REUTERS/Loren Elliott

Judge David Briones, of U.S. District Court in El Paso, Texas, issued the injunction in a 21-page ruling.

The ruling is a setback for Trump, whose administration has vowed to build at least 450 miles of wall along the border by November 2020, when the U.S. presidential election will take place. Trump has argued the wall will deter illegal border crossings, a major focus of his presidency.

A Justice Department spokesman said the administration would appeal the ruling.

Trump declared a national emergency last February in order to transfer funds from the Pentagon to build the wall after Congress refused to provide the level of funding he sought.

Top Democrats in Congress have criticized the project as wasteful and ineffective.

In the lawsuit, the plaintiffs, El Paso County and the Border Network for Human Rights, an El Paso-based immigration reform group, argued that Trump exceeded his authority when he declared the emergency and sought to redirect the funds.

Kristy Parker, counsel for Protect Democracy, an organization that represented plaintiffs in the case, said in a statement that the order “affirms that the president is not a king and that our courts are willing to check him when he oversteps his bounds.”

Briones ruled in October that the proclamation was unlawful and then asked the plaintiffs to file a proposed preliminary injunction. He said in that ruling that the transfer of the military funds was unlawful because it went against the intent outlined by Congress in the spending bill it passed in January 2019.

Trump had pressed Congress in December 2018 for $5.7 billion in funds to build a border wall, which led to 35-day partial shutdown of the federal government when Congress. When lawmakers provided only a quarter of that amount, Trump declared immigration a national emergency as part of a plan to use a similar amount from the Defense Department and Treasury Department for wall construction.

The Supreme Court ruled in July that the Trump administration could access a separate pot of $2.5 billion from a Pentagon counter-narcotics fund to pay for wall construction pending a related appeal - a major victory for Trump.

Acting Homeland Security Secretary Chad Wolf said at news conference in El Paso last month that 83 miles of border wall had been built under Trump and that another 153 miles of border wall was under construction.

“President Trump has been clear,” Wolf said. “We will build the wall, and he is following through on his promise.”