Trump issued the order on January 25, seeking to deny billions of dollars to cities that harbor undocumented immigrants.
However, US District Judge William Orrick III (pictured below) in San Francisco blocked the order on Tuesday, striking a fresh blow to the president’s pledged clampdown on illegal immigration.
"Federal funding that bears no meaningful relationship to immigration enforcement cannot be threatened merely because a jurisdiction chooses an immigration enforcement strategy of which the president disapproves," Orrick said.
He said the intent of the Trump administration was to use this issue as a "weapon” against cities that resist his policies, calling the move unconstitutional.
"The constitution vests the spending powers in Congress, not the president, so the order cannot constitutionally place new conditions on federal funds," he said.
White House Chief of Staff Reince Priebus said the Trump administration was taking action to appeal the ruling.
"The idea that an agency can't put in some reasonable restrictions on how some of these monies are spent is something that will be overturned eventually," Priebus said.
Trump's order could impact over 300 cities and counties that have lamented his immigration policy.
The decision threatened the transfer of around $1.7 billion to Santa Clara County and $1.2 billion to San Francisco in California.
The government’s lawyers challenged the right of the two places to fight the order because neither of them had been formally declared "sanctuary jurisdictions."
Meanwhile, the US Department of Justice on Friday threatened to clamp down on the "sanctuary cities,” saying it would cut off their funding if they refused to hand over undocumented immigrants suspected of a crime.
Orrick’s order is another blow to the White House after two other judges blocked Trump’s two travel bans targeting Muslim-majority countries.
Trump has pledged to deport millions of undocumented immigrants and keep Latin American immigrants from illegally entering the country by building a wall on the border with Mexico.