WASHINGTON — President Donald 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. Mr. Trump tweeted, “Just signed Bill. Our Military will now be stronger than ever before. We love and need our Military and gave them everything – and more. First time this has happened in a long time. Also means JOBS, JOBS, JOBS!”

Congress passed a $400 billion budget deal in the wee hours of Friday morning after a partial government shutdown began at midnight. The House approved the legislation with a 240-186 vote hours after the Senate OK’d the package.

Just before the final House vote, Speaker Paul Ryan spoke on the floor and reiterated his commitment to “working together on an immigration measure we can make law” after a budget measure passes.

Protecting “Dreamers” and DACA recipients has been center stage in the ongoing budget debates in Congress. Democrats have been using funding legislation for leverage on their immigration concerns.  

As the House voted on the procedural measure in the middle of the night, the mood in the House chamber was rather relaxed, reports CBS News’ Rebecca Kaplan. Many members returned to the Capitol in the early morning hours — nearly all still in their business attire — and sat chatting with each other.

House GOP leaders Ryan, Majority Leader Kevin McCarthy and Whip Steve Scalise stood together chatting and occasionally reviewing pieces of paper but didn’t appear to be engaged in an urgent operation to whip votes — suggesting confidence that the measure would pass. 

The earlier Senate vote was the first big step in a rush to pick up the pieces of a budget and spending plan that had seemed on track hours earlier. But the government stumbled into the shutdown, the second in three weeks, at midnight after a single senator mounted a protest over the budget-busting deal and refused to give in.

Republican Kentucky Sen. Rand Paul put the brakes on Senate leaders’ plan to drive the agreement quickly through the Senate, repeatedly blocking a Thursday vote and provoking colleagues’ frustration. 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. Paul brushed off the pressure.

“I didn’t come up here to be part of somebody’s club. I didn’t come up here to be liked,” he said.

Once Paul time was up, the measure, backed by the Senate’s top leaders, sailed through the chamber by a 71-28 vote.

The situation was trickier in the House after liberal Democrats and tea party conservatives both swung into opposition.

The underlying 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 ceiling, preventing a first-ever default on U.S. 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.

House leaders hustled to move before federal employees were due back at work, hoping to minimize the disruption. A shutdown essentially cuts the federal workforce in half, with those dubbed non-essential not allowed to work. Military and essential workers would remain on the job regardless.

The Trump administration signaled it expected the shutdown to be short, calling it a “lapse.”

As the clock hit midnight, Office of Management and Budget Director Mick Mulvaney immediately issued an order to close non-essential government operations.

Mulvaney told federal agencies they should execute their contingency plans and instructed federal employees to report to work Friday to “undertake orderly shutdown activities.”

At the White House, there appeared to be little sense of concern. Aides closed shop early Thursday night, with no comment on the display on the Hill. The president didn’t tweet. Vice President Mike Pence, in South Korea for the Winter Olympics, said the administration was “hopeful” the shutdown wouldn’t last long.

But frustrations were clear in both sides of the Capitol, where just hours earlier leaders had been optimistic that the budget deal was a sign they had left behind some of their chronic dysfunction. Senate Democrats sparked a three-day partial government shutdown last month by filibustering a spending bill, seeking relief for “Dreamer” immigrants who’ve lived in the country illegally since they were children.

House GOP leaders said they were confident they had 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. House Speaker Nancy Pelosi, D-Calif., asked Speaker Paul Ryan in a Thursday night letter to promise he would bring an immigration measure sponsored by Reps. Will Hurd, R-Texas, and Pete Aguilar, D-Texas, up for a vote.

Ryan didn’t immediately respond. He said again Thursday he was determined to bring an immigration bill to the floor this year – albeit only one that has President Donald Trump’s blessing.

Pelosi again pressed Ryan on the immigration legislation during the debate on the House floor during the early morning hours Friday.

At a late afternoon meeting of House Democrats, 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.

Still, it represented a bitter defeat for Democrats who followed a risky strategy to use the party’s leverage on the budget to address immigration and ended up scalded by last month’s shutdown. Protection for the Dreamers under former President Obama’s Deferred Action for Childhood Arrivals program, or DACA, expires next month.

Republicans were sheepish 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.

“I love bipartisanship, as you know,” said Sen. Jeff Flake, R-Ariz. “But the problem is the only time we discover bipartisanship is when we spend more money.”

The deal contains far more money demanded by Democrats than had seemed possible only weeks ago.

“We’re not going to get DACA as part of this,” said Rep. John Yarmuth of Kentucky, the top Democrat on the Budget Committee. “So if we can negotiate a deal like I think we’ve gotten that essentially meets every other one of our priorities then I think that’s where a lot of the Democrats are.”