President Donald Trump has won a judge's permission to build a border wall with Mexico. Now he just needs the money.

A judge who was taunted by Trump during the presidential campaign sided on Tuesday with the president on a challenge to building the wall. U.S. District Judge Gonzalo Curiel rejected arguments by the state of California and advocacy groups that the administration overreached by waiving laws requiring environmental and other reviews before construction can begin.

"Big legal win today," Trump tweeted in response to the ruling. He didn't mention his prior remarks about the judge's Mexican heritage.

Donald Trump tweet

Despite the victory, Congress has yet to fund the wall and Trump's demands that Mexico pay have gone nowhere. This month, the Senate rejected a request for $18 billion that was part of a package including sharp cuts to legal immigration and permission for young immigrants to stay in the country after they were temporarily shielded from deportation under an Obama-era program, Deferred Action for Childhood Arrivals.

Trump berated Curiel during the campaign for his handling of fraud allegations against now-defunct Trump University, suggesting the Indiana-born judge's Mexican heritage reflected a bias.

Curiel mentioned his Indiana roots in his 101-page ruling on the wall when he cited another native of the state, U.S. Supreme Court Chief Justice John Roberts, who wrote in another case that courts should not make policy judgments.

"The court cannot and does not consider whether the underlying decisions to construct border barriers are politically wise or prudent," Curiel wrote.

Curiel wrote that the law certainly "is not a model of legislative precision" and that both sides made plausible arguments, preventing him from making a clear finding that the administration overreached.

The administration has issued three waivers since August, two to build in parts of California and one in part of New Mexico. President George W. Bush's administration issued the previous five waivers, allowing the government to quickly extend barriers to about one-third of the border.

The Center for Biological Diversity said in its lawsuit that the waiver authority cannot be interpreted to last forever. California argued that it expired in 2008, when Homeland Security satisfied congressional requirements at the time on how much wall to build.

The judge declined to second-guess the administration's findings that waivers were issued in areas of "high illegal entry," a requirement set by Congress. The advocates argued that dramatic declines in border arrests undermined those findings.

During arguments this month, the judge peppered both sides with questions about the law's meaning. He showed strong interest in a requirement tacked on in late 2007 for Homeland Security to consult other federal agencies, state and local governments, Indian tribes and property owners to minimize the impact of construction, which challengers said the administration failed to do.

Curiel said in his ruling that the law's lack of specifics prevented him from concluding that the administration failed to properly consult others.

The Center for Biological Diversity, which sued along with the state of California and three advocacy groups, said it would appeal. Construction can proceed for now.

California Attorney General Xavier Becerra said, "We 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."

The Animal Legal Defense Fund said it may ask the U.S. Supreme Court to intervene. The Sierra Club said the environmental and other reviews are critical to protecting border communities, but the group didn't discuss its next step.

U.S. Justice Department spokesman Devin O'Malley welcomed the decision, saying Congress granted authority to build a wall without delay and that the administration is pleased it can continue "this important work vital to our nation's interests."

Homeland Security spokesman Tyler Houlton added, "Simply put, walls work."

The decision came days after construction began on a 30-foot (9.1-meter) high barrier in Calexico, California, the administration's first wall project outside of eight prototypes in San Diego that were completed in October and are intended to guide future construction. Both projects carry a relatively small price tag and were funded last year.