Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WASHINGTON — In a hastily announced event, President Donald Trump announced Friday afternoon that he had just signed a bill to fund the government "as a matter of national security," hours after a tweeted threat that he was weighing a veto of the $1.3 trillion bill.

Speaking at the White House, Trump called the spending bill a "ridiculous situation," while standing in the White House Diplomatic Room, flanked by Vice President Mike Pence and several Cabinet members.

"There are a lot of things I'm unhappy about in this bill," the president said, pointing to the inclusion of unspecified items that he said were added in order to get necessary funding for the U.S. military.

"In this case, it became so big because we need to take care of our military and because Democrats, who don't believe in that, added things that they wanted in order to get their votes," Trump explained.

Asked about his earlier veto threat, Trump told reporters he “looked very seriously at the veto” and “was thinking about doing the veto but because of the incredible gains we’ve been able to make for the military, that overrode any of our thinking.”

But Trump also said this would be the last time he would sign such a spending measure.

"I say to Congress: I will never sign another bill like this again," Trump promised. "Nobody read it. It's only hours old. ... (It's) the second-largest ever. President Obama signed one that was actually larger, which I'm sure he wasn't too happy with either."

Trump also demanded that the Senate end the filibuster rule, as well as allow the president a "line-item veto for all government spending bills" going forward.

The signing capped off hours of drama in Washington with lawmakers, Capitol Hill staffers and White House aides blindsided by the president's threat on Twitter to veto the bill, which temporarily upended the previously agreed upon deal for government funding.

Trump's threat prompted renewed concerns of yet another government shutdown — because the measure doesn't adequately fund his desired border wall or protect recipients of the DACA program his administration ended.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

On Friday at the White House, the president said DACA should have been among the items included in the spending bill, blaming Democrats for its absence.

“I say this to DACA recipients: that the Republicans are with you, they want to get your situation taken care of. The Democrats fought every single inch of the way, they did not want DACA in this bill.”

And while funding for the wall did not reach the level the president had hoped for, he predicted that the $1.6 billion that was allocated for it in the short term would “go very far.”

Earlier, Trump had said he might not sign the measure into law due to his dissatisfaction with how both issues had been addressed in the bill. "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 Friday morning.

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. — Donald J. Trump (@realDonaldTrump) March 23, 2018

The warning contradicted assurances from high-ranking White House officials who a day earlier had left no doubt Trump would sign the measure before the government funding deadline of Friday at midnight.

"Let's cut right to the chase. Is the president going to sign the bill? The answer is yes," Director of the Office of Management and Budget Mick Mulvaney told reporters at the White House on Thursday. "Why? Because it funds his priorities."

Pence, at a tax policy event in New Hampshire on Thursday, said the bill funds several of the administration’s priorities, including a border wall, school safety, the opioid crisis and infrastructure.

"It’s filled with one example after another that proves when it comes to President Trump, it’s promises made, promises kept," he said.

The White House even published a Statement of Administration Policy on Thursday that "supports passage" of the bill.

But before Trump said he had signed the bill Friday, White House spokesman Hogan Gidley said, "The tweet stands for itself."

When asked whether the president had reached out to Senate Majority Leader Mitch McConnell or House Speaker Paul Ryan about his last-minute concerns, Gidley indicated that he had nothing further to add to the president’s comment.

Within moments of Trump's tweet, a number of other Republicans expressed support for a veto.

Sen. Bob Corker, R-Tenn, encouraged the president to follow his instinct.

“Please do, Mr. President. I am just down the street and will bring you a pen,” Corker wrote. “The spending levels without any offsets are grotesque, throwing all of our children under the bus. Totally irresponsible.”

Please do, Mr. President. I am just down the street and will bring you a pen. The spending levels without any offsets are grotesque, throwing all of our children under the bus. Totally irresponsible. https://t.co/np7BmP1AkB — Senator Bob Corker (@SenBobCorker) March 23, 2018

Sen. Rand Paul, R-Ky., concurred. Paul caused the government to briefly shut down in February when he filibustered a short-term spending bill under consideration at the time.

"I agree @realDonaldTrump should veto this sad excuse for legislation because it’s $1.3 trillion in spending that (almost) no one read," he tweeted.

And the conservative House Freedom Caucus tweeted that it had sent a letter to Trump on Wednesday, urging him "to veto the omnibus over a lack of wall funding, among other issues."

Trump's tweet came only hours after the Senate early Friday morning passed the $1.3 trillion deal that would fund federal government operations through Sept. 30 and avert what would have been the third government shutdown this year.

The Senate sent the bill, which the House approved on Thursday, to Trump for his signature after both chambers has left Washington for the Easter/Passover recess. They're scheduled to return in two weeks.

Funding for the federal government was set to expire after 11:59 p.m. Friday evening.

Trump’s veto threat was just the latest holdup for the bill, which was released Wednesday, after a days-long impasse over issues involving border security, an infrastructure project and gun-related provisions.