U.S. President Donald Trump targeted the western U.S. state of California Tuesday for its leading role in a multi-state lawsuit contesting his declaration of a national emergency to obtain funding for his proposed wall along the U.S.-Mexico border.

On Twitter, Trump cited California Governor Gavin Newsome's cancellation last week of a high-speed rail line between Los Angeles and San Francisco, claiming, without evidence, the cancellation was due to "world record setting" cost overruns.

Trump followed with another tweet after 16 states sued his administration over his declaration of a national emergency to get funds to build a border wall. Attorneys general, led by California, filed their lawsuit late Monday in the U.S. District Court for the Northern District of California.

The complaint alleges the emergency declaration is illegal and unconstitutional, and that it harms the states and their residents by taking money away from anti-drug programs, military construction projects and other law enforcement efforts.

The lawsuit asks the court to permanently prohibit the Trump administration from diverting funds from elsewhere in the government to construct a border wall, or to build a wall without Congress appropriating money for that purpose.

"President Trump treats the rule of law with utter contempt," California Attorney General Xavier Becerra said. "He knows there is no border crisis. He knows his emergency declaration is unwarranted, and he admits that he will likely lose this case in court."

Becerra accused Trump of engaging in "theater" and hyping a crisis because he failed to get Congress or Mexico to pay for the wall.

An environmental group and three Texas landowners across whose property the wall would be built have already filed lawsuits.

The White House has not yet responded to the states' lawsuit. But it had anticipated court challenges to the emergency declaration.

Trump said he declared the national emergency because he was unhappy with the amount of money Congress authorized for border security.

"I want to do it faster," he said when he announced his declaration last week. "I could do the wall over a longer period of time. I didn't need to do this. But I’d rather do it much faster" — words that could come back to haunt the administration in court.

Journalist Bob Woodward, who chronicled the first year of the Trump presidency in his best-selling book "Fear," told Fox News he believes Trump made the national emergency declaration because "he looks strong. He looks tough to lots of people."

FILE - A new barrier is built along the Texas-Mexico border near downtown El Paso, Jan. 22, 2019.

Trump centered much of his 2016 presidential campaign on a vow to build the wall and make Mexico pay for it. After he was elected, he said he never meant that Mexico would write a check for a wall, but that the money would come from the benefits from a new North American trade deal.

Mexican leaders have said under no circumstances would they pay for a border wall. Trump has since shifted the focus on winning congressional funding.