President Trump on Friday signed a $400 billion budget deal that sharply boosts spending and swells the federal deficit, ending a brief federal government shutdown that happened while most Americans were home in bed and most government offices were closed, anyway.

The House and Senate approved a bill to keep the government funded through March 23, overcoming opposition from liberal Democrats as well as tea party conservatives to endorse enormous spending increases despite looming trillion-dollar deficits. The House voted 240 to 186 to approve the bill just before dawn Eastern time, hours after the Senate had approved the measure on a 71 to 28 vote.

Mr. Trump tweeted Friday morning that he had signed the bill, writing that the US military "will now be stronger than ever before." The budget bill "also means JOBS, JOBS, JOBS!" Trump tweeted.

The twin votes put to rest a brief federal freeze that relatively few would notice. Many who did quickly labeled it a pointless, head-scratching episode. The shutdown was the second partial government shutdown in three weeks.

The breakdown came largely in the Senate, when after a day of inaction, Sen. Rand Paul (R) of Kentucky went rogue and stalled a vote in protest over his party's willingness to bust the budget. Democrats also had their divisions and wrangling, largely with liberals upset that the measure was not tied to any plans to assist the "Dreamer" immigrants.

Most Democrats opposed the measure, following the lead of House minority leader Nancy Pelosi, who tried and failed to use the moment to secure a promise for a separate vote on immigration. Up to the final minutes, it was not clear the bill would pass and many Democrats held their votes, allowing the tally to creep slowly and giving no indication which way it might fall.

House Speaker Paul Ryan urged Congress to avoid a "second needless shutdown in a matter of weeks – entirely needless."

There was far less drama in the Senate, where the measure sailed through by a 71-28 tally once Senator Paul's protest ran its course.

The White House was forced to order the government shutdown shortly after midnight, but leaders quickly hustled to move before federal employees were due back at work, hoping to minimize the disruption.

The White House kept its distance from the quarreling on Capitol Hill. Trump did not tweet on the issue Thursday and aides did not try to assign blame.

Senate GOP leaders, however, were clearly irked by the debacle. In his attempt to sway Paul to relent, Texas Sen. John Cornyn (R) declared his fellow Republican was "wasting everyone's time" and prompting a shutdown for "no good reason." But Paul, the resident contrarian, repelled suggestions to stand aside.

"I didn't come up here to be part of somebody's club. I didn't come up here to be liked," Paul said.

The budget agreement is married to a six-week temporary funding bill needed to keep the government operating and to provide time to implement the budget pact.

The bill includes huge spending increases sought by Republicans for the Pentagon along with a big boost demanded by Democrats for domestic agencies. Both sides pressed for $89 billion for disaster relief, extending a host of health care provisions, and extending a slew of smaller tax breaks.

It also would increase the government's debt cap, preventing a first-ever default on US obligations that looms in just a few weeks. Such debt limit votes are usually enormous headaches for GOP leaders, but the increase means another vote won't occur before March 2019.

Senate leaders had celebrated the budget deal as a sign they had left behind some of their chronic dysfunction. Just three weeks ago, Senate Democrats sparked a three-day partial government shutdown by staging a filibuster on a spending bill, seeking relief for "Dreamer" immigrants who've lived in the country illegally since they were children.

Senate Democrats had no appetite for another shutdown.

House GOP leaders shored up support among conservatives for the measure, which would shower the Pentagon with money but add hundreds of billions of dollars to the nation's $20 trillion-plus debt.

House Democratic leaders opposed the measure – arguing it should resolve the plight of Dreamers – but not with all their might. Representative Pelosi made it plain she wasn't pressuring her colleagues to kill the bill, which is packed with money for party priorities like infrastructure, combating opioid abuse, and helping college students.

"She negotiated the deal. Her team was in on it," said top GOP vote counter Rep. Patrick McHenry of North Carolina. "And they were a 'no.' And at the end her team broke."

Pelosi continued to press Ryan for a promise to bring an immigration measure sponsored by Rep. Will Hurd (R) of Texas, and Rep. Pete Aguilar (D) of California, up for a vote. But many Democrats backed the spending measure without that assurance.

Ryan said again Thursday he was determined to bring an immigration bill to the floor this year – albeit only one that has Trump's blessing.

"We will solve this DACA problem," Ryan said just before the vote. "Once we get this budget agreement done ... we will focus on bringing that debate to this floor and finding a solution."

The episode was a clear defeat for Democrats who had followed a risky strategy to use the party's leverage on the budget to address immigration. Protection for the Dreamers under former President Barack Obama's Deferred Action for Childhood Arrivals program, or DACA, formally expires March 5 and there's no sign that lawmakers are making progress on an agreement to extend the program.

Republicans, too, had their disappointments. Many were sheepish or even angry about the bushels of dollars for Democratic priorities and the return next year of $1 trillion-plus deficits. But they pointed to money they have long sought for the Pentagon, which they say needs huge sums for readiness, training, and weapons modernization.

"It provides what the Pentagon needs to restore our military's edge for years to come," said Ryan.

Beyond $300 billion worth of increases for the military and domestic programs, the agreement adds $89 billion in overdue disaster aid for hurricane-slammed Texas, Florida, and Puerto Rico, a politically charged increase in the government's borrowing cap and a grab bag of health and tax provisions. There's also $16 billion to renew a slew of expired tax breaks that Congress seems unable to kill.

Get the Monitor Stories you care about delivered to your inbox. By signing up, you agree to our Privacy Policy

"I love bipartisanship, as you know," said Sen. Jeff Flake (R) of Arizona. "But the problem is the only time we discover bipartisanship is when we spend more money."

This story was reported by The Associated Press.