Hours after threatening a veto that would have triggered a government shutdown, President Trump signed a major spending bill after all Friday in order to preserve increases in defense spending.

While criticizing the plan's relative lack of funding for a border wall and failure to address an immigration program for children, Trump described the military increases as essential to national security.

"My highest duty is to keep America safe," Trump said.

He added, "there's a lot of things I'm unhappy about, and I will never sign another bill like this again." He again called for an end to the filibuster rule that allows the minority party to block items unless they receive 60 votes -- a maneuver the Democrats used to extract concessions from Trump and the Republicans in this bill.

Trump announced a prospective veto and then changed his mind amid mass confusion among his staff, and Republican lawmakers; it was unclear whether Trump would take questions at a quickly called "news conference."

Trump also balked at the overall $1.3 trillion price tag of the bill -- "that number is so large" -- but said "we had no choice but to fund our military."

He also vowed to keep pushing for funding of an anti-migration wall along the U.S.-Mexico border.

In a surprise tweet earlier on Friday, Trump cited a lack of funding for a proposed wall along the U,S,-Mexico border, as well as the failure to address a program for children whose parents brought them into the country illegally.

"I am considering a VETO of the Omnibus Spending Bill based on the fact that the 800,000 plus DACA recipients have been totally abandoned by the Democrats (not even mentioned in Bill) and the BORDER WALL, which is desperately needed for our National Defense, is not fully funded," Trump tweeted.

The tweet no doubt surprised Republican congressional leaders, who thought they had secured Trump's approval earlier this week.

With neither House or Senate in session today, the response from members of Congress took the form of a cascade of tweets.

One of the first to respond. Sen. Bob Corker, R-Tenn., encouraged Trump to veto the bill.

"I am just down the street and will bring you a pen," Corker said. "The spending levels without any offsets are grotesque, throwing all of our children under the bus. Totally irresponsible."

Rep. Mark Meadows, R-N.C., chairman of the ultra-conservative House Freedom Caucus, and Sen. Rand Paul, R-Ky, joined Corker's call for Trump to veto the bill.

Sen. John Cornyn, R-Texas, the assistant majority leader, offered his own criticism of Democrats but added that the omnibus spending bill contained many positives.

House Minority Whip Steny Hoyer of Maryland offered these reminders to Trump.

Less than 24 hours before Trump's tweet, White House budget director Mick Mulvaney said the president would sign the bill, despite some misgivings.

It's unclear whether Congress could have even made changes before midnight, when the current government spending plan was set to expire. That would have triggered a shutdown.