District Court Judge David Briones, a Bill Clinton appointee, ruled in an El Paso court Tuesday that the money cannot be diverted to build 175 miles of steel barriers along the U.S.-Mexico border.
The El Paso County and Border Network for Human Rights sued the administration in October, claiming President Trump overstepped his authority when he issued a national emergency declaration to get additional funds for the wall -- his signature 2016 campaign promise.
Congress had already given him $1.375 billion for wall construction.
Briones ruled in October to temporarily halt the president's plan to use the Pentagon funds. His Tuesday ruling only applies to the $3.6 billion, not other money available to the administration, including funds from counter-drug operations.
In September, Defense Secretary Mark Esper signed off on spending the $3.6 billion, provoking outcry from Democrats and immigration-rights advocates.
Kristy Parker, an attorney with the nonprofit group Protect Democracy who represented the plaintiffs, described Trump's declaration as a power grab.
"Today’s order affirms that the president is not a king and that our courts are willing to check him when he oversteps his bounds," Parker said in a statement. "This is a huge win for democracy and the rule of law.”
Earlier this year, the Supreme Court paved the way for the administration to use $2.5 billion in Pentagon funds to replace existing fencing in California, Arizona and New Mexico.
The Trump administration is expected to appeal Tuesday's decision.