WASHINGTON — The government stumbled into a midnight shutdown Thursday as a rogue Senate Republican blocked a speedy vote on a massive, bipartisan, budget-busting spending deal, protesting the return of trillion-dollar deficits on the watch of Republicans controlling Washington.

A shutdown — technically a lapse in agency appropriations — became inevitable as GOP Sen. Rand Paul repeatedly held up votes on the budget plan, which is married to a six-week government-wide spending measure. The Senate recessed around 11 p.m. with plans to reconvene just after midnight.

Paul was seeking a vote on reversing spending increases and refused to speed things up when he was denied.

“I ran for office because I was very critical of President Obama’s trillion-dollar deficits,” the Kentucky senator said. “Now we have Republicans hand in hand with Democrats offering us trillion-dollar deficits. I can’t in all honesty look the other way.”

While the government’s authority to spend some money would expire at midnight, there weren’t likely to be many clear immediate effects. Essential personnel would remain on the job regardless, and it appeared possible — if not likely — that the measure could pass both the Senate and House before most federal employees were due to report for work.

If the measure passes in the wee hours of the morning, the government would open in the morning on schedule, said John Czwartacki, spokesman for the Office of Management and Budget, the agency responsible for coordinating any shutdown.

At the White House, there appeared to be little sense of concern. Aides closed shop early in the night, with no comment on the display on the Hill. The president did not tweet.

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. This time it was a Republican’s turn to throw a wrench in the works.

Paul brushed off pleas from his fellow Republicans, who billed the budget plan as an “emergency” measure needed for a depleted military.

“We will effectively shut down the federal government for no good reason,” said Sen. John Cornyn, as his requests to move to a vote were repeatedly rejected by Paul.

Paul was unfazed.

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

Approval of the measure in the Senate seemed assured — eventually — but the situation in the House remained dicey. In that chamber, progressive Democrats and tea party Republicans opposed the measure, which contains roughly $400 billion in new spending for the Pentagon, domestic agencies, disaster relief and extending a host of health care provisions.

However, 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.

The legislation doesn’t address immigration, though Republican Speaker Paul Ryan 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.

At a late afternoon meeting, House Democratic Leader Nancy Pelosi of California made it plain she wasn’t pressuring fellow Democrats 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 three-day government shutdown. Protection for the Dreamers under former President Barack 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 record 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.”

Added conservative Democrat Henry Cuellar of Texas, “It’s an easy ‘yes.'”

Combined with the Republicans’ December tax cut bill, the burst in spending would put the GOP-controlled government on track for the first $1 trillion-plus deficits since Obama’s first term and the aftermath of the most recent recession nine years ago.

“This budget deal shows just how broken the budget process is, that Congress thinks the only way to agree to a budget is to put hundreds of billions of dollars on the nation’s credit card,” said Maya MacGuineas, president of the Center for a Responsible Federal Budget, a Washington-based group.

The agreement would increase the government’s borrowing limit to prevent a first-ever default on U.S. obligations that looms in just a few weeks. The debt limit would be suspended through March 2019, putting the next vote on it safely past this year’s midterm elections.