"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!" Trump wrote. "California, the state that has wasted billions of dollars on their out of control Fast Train, with no hope of completion, seems in charge!"
He was referencing a high-speed rail project, which California Governor Gavin Newsom (D) recently announced would be dramatically scaled back after costs ballooned from $45 billion to $77 billion.
"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!" Trump wrote.
Trump is seeking to spend roughly $8 billion on border barrier construction, only about $1.4 billion of which has been approved by Congress. He plans to tap money from other funds, including drug-interdiction and military construction projects.
The lawsuit filed Monday argues that the president's decision to declare a national emergency is unconstitutional. It seeks a preliminary injunction that would prevent Trump from acting on his declaration while the case plays out in the courts.
It was brought by 16 states, all of which have Democratic governors, except for Maryland. Under Maryland law, the state's attorney general can take legal actions without the blessing of the governor. Maryland Attorney General Brian Frosh, whose name is in the complaint, is a Democrat who has sued the Trump administration over other policy issues.
In addition to California and Maryland, the states participating in the suit are Colorado, Connecticut, Delaware, Hawaii, Illinois, Maine, Michigan, Minnesota, Nevada, New Jersey, New Mexico, New York, Oregon and Virginia.
The complaint was filed in US District Court for the Northern District of California, a San Francisco-based court whose judges have ruled against an array of other Trump administration policies, including on immigration and the environment. The court is part of the 9th Circuit.
During his remarks last week in the Rose Garden, Trump acknowledged the possibility that lower courts could rule against him on the emergency declaration, but he expressed hope that he would prevail in the Supreme Court.
Speaking to reporters in the Oval Office later Tuesday, Trump sounded more confident of his standing.
"I think in the end, we're going to be very successful with the lawsuit," he said, adding that he might even prevail within the 9th Circuit.
California Attorney General Xavier Becerra, a Democrat, responded to Trump's tweets Tuesday afternoon.
"Sorry, Mr. President," Becerra wrote on Twitter. "(hash)California will keep leaning forward. Instead of walls, we've built America's #1 economy and the 5th largest in the world - thanks in large part to our respect for the law and humane policies."
In another tweet, Becerra urged Trump to "keep talking" as attorneys general continue to gather evidence to support our lawsuit against you." He added: "#FakeNationalEmergency"
In his remarks to reporters, Trump also took a shot at Beto O'Rouke, the former Democratic congressman from Texas, who recently said he would like to see existing barriers along the border torn down.
"That's probably the end of his political career," Trump said of O'Rourke, who is considering a 2020 White House bid.