The state of California and various environmental group had argued that waivers to environmental regulations, which were granted so construction of border wall prototypes and the replacement of existing border fencing could proceed, exceeded authority granted by Congress, were unconstitutional, or both.
Gonzalo Curiel ruled in favor of the US government, but also made clear that the decision was separate from the underlying issue of whether or not the wall the cost of which could run into the tens of billions of dollars should be built.
"Court is aware that the subject of these lawsuits, border barriers, is currently the subject of heated political debate in and between the United States and the Republic of Mexico as to the need, efficacy and the source of funding for such barriers," he wrote.
"In its review of this case, the Court cannot and does not consider whether underlying decisions to construct the border barriers are politically wise or prudent."
Trump took to Twitter to hail the ruling, terming it a "big legal win."
"Now this important project can go forward!" he tweeted.
"He's a Mexican," Trump said of Curiel, who was born and raised in the United States. "We're building a wall between here and Mexico.
"I have a Mexican judge. He's of Mexican heritage. He should have recused himself, not only for that, for other things," Trump said.
Building a wall on the border with Mexico was one of Trump's main campaign promises.
But while the president said that Mexico would pay for its construction, it seems increasingly likely that American taxpayers will be footing the bill.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.