SAN FRANCISCO (Reuters) - A U.S. judge on Tuesday sided with President Donald Trump’s administration and rejected an attempt by the state of California and environmental groups to stop the government from building a wall on the U.S. border with Mexico.

Slideshow ( 2 images )

The lawsuit filed in a San Diego federal court alleged that Trump’s proposed wall violates federal environmental standards, as well as constitutional provisions regarding the separation of powers and states’ rights.

The plaintiffs asked U.S. District Judge Gonzalo Curiel to stop the administration from pursuing the barrier until it demonstrates compliance with environmental laws.

The wall, a key item for Trump’s political base of supporters, has become a sticking point in talks to keep alive a federal program that protects from deportation young people who were brought to the United States illegally as children.

In his latest budget proposal to Congress, Trump requested $23 billion for border security, most of it for building the wall.

Curiel said his decision on Tuesday was not based on whether the underlying decisions to construct the wall “are politically wise or prudent.” Rather, Curiel said the Trump administration had not exceeded its legal authority in pursuing the project.

In a statement, U.S. Department of Justice spokesman Devin O’Malley said it is pleased the government can continue with the 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,” he said.

California Attorney General Xavier Becerra, meanwhile, said in a statement his office remained opposed to the border wall and would evaluate its options.

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

Trump and Mexican President Enrique Pena Nieto postponed plans for the Mexican leader’s first visit to the White House, after a testy phone call in which Trump would not agree to publicly affirm Mexico’s position that it would not fund construction of the wall.

Trump accused Curiel of bias during the 2016 presidential campaign based on the Indiana-born judge’s Mexican ancestry. At the time, Curiel had been overseeing a separate lawsuit involving Trump University.

In his ruling on the wall, Curiel cited “fellow Indiana native Chief Justice [John] Roberts” to argue that it is not the court’s place to make policy judgments.