Sixteen states filed a lawsuit to challenge President Donald Trump's national-emergency declaration, which he made to access extra funding for his proposed border wall.

Friday's emergency declaration aims to divert about $6 billion from other federal budgets. Congress had approved $1.357 billion for a border wall, far less than Trump asked for.

The states — all but one of which have a Democratic governor — say that Trump does not have grounds to declare an emergency and that his declaration is unconstitutional.

Trump himself said last week that he "didn't need to" declare a national emergency but did so to build the wall "much faster."

The president tweeted on Tuesday that he "predicted" this lawsuit, and he specifically attacked California over it.

Sixteen US states are jointly suing President Donald Trump's administration over Trump's declaration of a national emergency to unlock funds for his border wall.

The 16-state coalition, led by California, filed a lawsuit in the US District Court in San Francisco on Monday.

The suit alleges that Trump has insufficient grounds to declare a national emergency. It says his claim that illegal immigration at the US-Mexico border constitutes a crisis is unfounded.

Trump has repeatedly referred to the situation at the border as "a crisis" and "an invasion."

The states involved in the lawsuit are California, Colorado, Connecticut, Delaware, Hawaii, Illinois, Maine, Maryland, Michigan, Minnesota, Nevada, New Jersey, New Mexico, New York, Oregon, and Virginia.

All those states have Democratic governors except Maryland, which has a Democratic attorney general.

A map showing the 16 states that filed a lawsuit against Trump's national-emergency declaration on Monday. amCharts/INSIDER

Trump declared a national emergency Friday to unilaterally build barriers along significant portions of the United States-Mexico border. Congress had granted him $1.375 billion for barrier construction, less than a quarter of the $5.7 billion he requested.

Trump's declaration, under the National Emergencies Act, aims to allow him to take some $6.1 billion from Title 10 funding for the armed forces.

This would consist of $2.5 billion under Department of Defense funds for counter-drug activities, up to $3.6 billion from Pentagon military construction projects, and $601 million from the Treasury's forfeiture fund.

Read more: Trump could tap the military's construction budget to build a border wall — here's what projects could be affected

The states behind the lawsuit said that Trump's declaration of a national border crisis was fabricated and that the emergency declaration and diversion of funds were unconstitutional and unlawful.

"President Trump has veered the country toward a constitutional crisis of his own making," the lawsuit said.

The lawsuit sought to use Trump's words against him, quoting his comments from last week's national-emergency declaration that "I didn't need to do this" but preferred to build the wall "much faster."

The states said that Trump had been calling for a wall along the US-Mexico border since at least August 2014 and that it had been a major talking point throughout the 2016 presidential election and other campaign rallies.

They added that Trump's justification for a wall — that it would prevent the illegal flow of drugs, gang members, human traffickers, and criminals into the US — were unfounded.

"The salient facts regarding the ostensible 'crisis' that President Trump repeatedly invoked in these numerous statements have not significantly changed since his inauguration as President in January 2017," the lawsuit said.

Trump at a tour of border-wall prototypes near the Otay Mesa Port of Entry in San Diego in March 2018. Reuters

Trump tweeted on Tuesday that he "predicted" the lawsuit, and he specifically attacked California for spending money on a high-speed-rail project rather than on the wall.

"As I predicted, 16 cities, led mostly by Open Border Democrats and the Radical Left, have filed a lawsuit in, of course, the 9th Circuit!" he tweeted, incorrectly referring to the 16 states as cities. "California, the state that has wasted billions of dollars on their out of control Fast Train, with no hope of completion, seems in charge!"

"The failed Fast Train project in California, were the cost overruns are becoming world record setting, is hundreds of times more expensive than the desperately needed Wall!" he added.

Trump last week accused of California of "having spent and wasted many billions of dollars" in federal funding on the project. Gov. Gavin Newsom called Trump's statement "fake news," saying it was California's money allocated by Congress.

Read more: California's newly elected Gov. Gavin Newsom schools Trump on the state's high-speed-rail project in one brutal tweet

Trump and Gavin Newsom, then California's governor-elect, in Paradise, California, in November. Evan Vucci/AP

To get a judge to hear the emergency-declaration dispute in court, the 16 states also have to show they will suffer from the declaration.

The lawsuit said the redirection of funding from military construction projects in some of the states would damage their economies and affect National Guard operations.

California and New Mexico also said in the lawsuit that the construction of a wall on their borders would cause "irreparable environmental damage."

Newsom with California's attorney general, Xavier Becerra, in Sacramento, California, on Friday. Rich Pedroncelli/AP

"President Trump treats the rule of law with utter contempt," Xavier Becerra, California's attorney general, said in a Monday statement. "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."

Newsom also said: "President Trump is manufacturing a crisis and declaring a made-up 'national emergency' in order to seize power and undermine the Constitution."

"This 'emergency' is a national disgrace," he added. "Rather than focusing on fighting the real vulnerabilities facing Americans, the President is using the powers of America’s highest office to fan the flames of nativism and xenophobia."

Numerous watchdog groups are also suing, or planning to sue, Trump over the emergency declaration. Citizens for Responsibility and Ethics in Washington filed a lawsuit against him four hours after the declaration.

The American Civil Liberties Union and Protect Democracy, a nonpartisan watchdog group, are expected to file separate lawsuits against Trump's emergency declaration this week, The New York Times reported.

Read the 16 states' lawsuit here.