A federal judge on Tuesday ruled against an environmental challenge to President Trump’s border wall, delivering a win to the Trump administration in a decision that allows construction plans to move forward.

In a 101-page ruling, U.S. District Court Judge Gonzalo Curiel wrote that both Congress and the executive branch “share responsibilities in protecting the country from terrorists and contraband illegally entering at the borders.”

The case involved the Trump administration’s ability to ignore environmental laws in the construction of the wall along the U.S.-Mexico border. The project had been challenged by several environmental groups and the state of California.

The ruling will now allow the administration to issue waivers on environmental laws and build sections of the border wall.

JUDGE WHO TRUMP CRITICIZED MAY DECIDE FATE OF BORDER WALL

“Border security is paramount to stemming the flow of illegal immigration that contributes to rising violent crime and to the drug crisis, and undermines national security," DOJ spokesman Devin O'Malley said Tuesday. "Congress gave authority to the Department of Homeland Security to construct a border wall without delay to prevent illegal entry into the United States, and we are pleased DHS can continue this important work vital to our nation’s interests.”

California Attorney General Xavier Becerra issued a statement saying his office “will evaluate all of our options and are prepared to do what is necessary to protect our people, our values, and our economy from federal overreach.”

“A medieval wall along the U.S.-Mexico border simply does not belong in the 21st century,” Becerra said.

Brian Segee, a senior attorney at the Center for Biological Diversity, which challenged the wall, said the group plans to appeal “this disappointing ruling, which would allow Trump to shrug off crucial environmental laws that protect people and wildlife.

“The Trump administration has completely overreached its authority in its rush to build this destructive, senseless wall,” Segee said. “They’re giving unprecedented, sweeping power to an unelected agency chief to ignore dozens of laws and crash through hundreds of miles of spectacular borderlands. This is unconstitutional and shouldn’t be allowed to stand.”

Had Curiel ruled against Trump, he could have undermined the construction of barriers on unfenced portions of the border.

The Trump administration was sued back in September as part of its effort to block any construction of the border wall.

Curiel is the federal judge who then-candidate Donald Trump once accused of being biased against him – due to Curiel’s Mexican ancestry – during the campaign.

Curiel, whose parents emigrated from Mexico, was attacked by Trump in 2016. Trump said the judge held “tremendous hostility” against him in a lawsuit involving Trump University because of Curiel’s Mexican descent.

Fox News' Ross Lee, Bill Mears, Corbett Miner, Lukas Mikelionis and The Associated Press contributed to this report.