By Erica Werner, Mike DeBonis, Washington Post–

Congress cleared a sweeping $1.3 trillion spending bill early Friday that doles out enormous increases to military and domestic programs alike, as Republicans and Democrats joined to block most of President Trump’s proposed budget cuts and place obstacles in the way of his immigration agenda.

The House passed the 2,232-page bill Thursday on a wide bipartisan vote. And after a day of maneuvering — including a bizarre dispute involving a senator upset about the renaming of a wilderness area after a deceased political rival — the Senate followed suit early Friday morning, passing the legislation 65 to 32.

The bill abandons GOP claims of fiscal discipline in a stark reversal of the promises many Republicans ran on in capturing control of the House in 2010 and the Senate in 2014 as they railed against what they described as a profligate President Barack Obama.

And in another about-face, House GOP leaders tossed aside their own rules and past complaints about Democrats to rush the legislation through the House ahead of a Friday night government shutdown deadline. Lawmakers of both parties seethed, saying they had scant time to read the mammoth bill, which was released less than 17 hours before they voted.

Nonetheless, House leaders of both parties declared victory following the 256-to-167 vote, and at the White House, Office of Management and Budget Director Mick Mulvaney said Trump would sign the bill.

“Is it perfect? No. Is it exactly what we asked for in the budget? No. Were we ever going to get that? No. That’s not how the process works,” Mulvaney said. “This is what a bill looks like when you have 60 votes in the Senate and the Democrats get a chance to take their pound of flesh.”

The legislation funds the federal government for the remainder of the 2018 budget year, through Sept. 30, directing $700 billion toward the military and $591 billion to domestic agencies. The military spending is a $66 billion increase over the 2017 level, and the nondefense spending is $52 billion more than last year.

House Minority Leader Nancy Pelosi, D-Calif., and Senate Minority Leader Chuck Schumer, D-N.Y., speak to reporters about the massive government spending bill moving through Congress, on Capitol Hill in Washington, Thursday, March 22, 2018. The bipartisan $1.3 trillion spending bill pours huge sums into Pentagon programs and domestic initiatives ranging from building roads to combatting the nation's opioid abuse crisis, but left Congress in stalemate over shielding young Dreamer immigrants from deportation and curbing surging health insurance premiums. (AP Photo/J. Scott Applewhite)© (AP Photo/J. Scott Applewhite) House Minority Leader Nancy Pelosi, D-Calif., and Senate Minority Leader Chuck Schumer, D-N.Y., speak to reporters about the massive government spending bill moving through Congress, on Capitol Hill in…

The spending bill is widely expected to be the last major legislation that Congress will pass before the November midterm elections, which had increased pressure to jam the bill full of odds and ends.

For hours after House passage, the legislation stalled in the Senate, where the chamber’s rules grant a single senator significant latitude to hold up a vote. Attention was initially focused on Sen. Rand Paul (R-Ky.), who forced the government into a brief shutdown last month when he objected to a budget bill that set the parameters for the legislation that is now pending.

Paul spent much of Thursday broadcasting his opposition to the spending bill via Twitter while keeping his colleagues in suspense about whether he would slow-walk the process past 12:01 a.m. Saturday and send the government into its third shutdown this year.

Paul’s tweetstorm highlighted what he views as wasteful spending in the bill, and he posted a picture of himself holding the hefty bill, while glaring balefully at the camera. “Shame, shame. A pox on both Houses — and parties. Here’s the 2,232 page, $1.3 trillion, budget-busting Omnibus spending bill,” the caption read.

Finally, late Thursday night, Paul spoke on the phone with Majority Leader Mitch McConnell (R-Ky.), and subsequently relented, telling The Washington Post that he’d been successful in drawing attention to problems with the bill, and was prepared to allow votes to go forward.

But just as Paul stood down, it emerged that he was not the only Republican senator objecting to the bill. Even as Paul was railing publicly against the bill, Sen. James E. Risch (R-Idaho) had been complaining behind the scenes, demanding that congressional leaders remove a provision in the bill naming the White Clouds Wilderness after former Democratic governor Cecil D. Andrus, according to two congressional aides familiar with the dispute.

Risch and Andrus had clashed when both served in state government. The renaming provision passed the House in February and has the support of Rep. Mike Simpson (R-Idaho), chairman of a House Appropriations subcommittee.

The Senate passed a stand-alone measure making the change he sought, which apparently satisfied Risch, who declined to comment.

“No. What part of ‘no’ don’t you understand? . . . Do I have a problem with my English? I don’t have any comment,” he told reporters outside the Senate floor.

Throughout the maneuvering, the ultimate outcome was not in question: The legislation would pass, bringing budget increases to federal agencies large and small, from the National Institutes of Health to the National Park Service to the Election Assistance Commission.

“Sometimes you save the president from himself,” said Rep. Tom Cole (R-Okla.), arguing the administration would not want to be in the position of cutting the NIH budget if a new pandemic comes along. “Look, a new administration always runs on things, and may or may not know government intimately.”

Conservatives fumed at the generous increases for many agencies, with some arguing it undercut their party’s claims to fiscal restraint.

“I don’t understand why when President Obama does what we’re about to do, it’s bad for the country, but when we do it, it’s good for the country,” said Sen. John Neely Kennedy (R-La.). “This bill is going to need a lot of Democratic support, and I suspect it’ll get it. They’re just as happy as kids at Christmas.”

Other Republicans, including House Speaker Paul D. Ryan (R-Wis.), argued the legislation fulfilled Trump’s governing agenda, including increasing military spending and funding a wall along the U.S.-Mexico border.

“This bill starts construction on the wall,” he told reporters. “It funds our war on opioids. It invests in infrastructure. It funds school safety and mental health. But what this bill is ultimately about, what we’ve fought for so long, is finally giving our military the tools and the resources it needs to do the job.”

House Minority Leader Nancy Pelosi (D-Calif.) called the bill “a tremendous victory for the American people,” one that keeps domestic agencies robustly funded while turning away Trump’s push for even more money for the border wall and immigration enforcement.

“If you want to think you’re getting a wall, just think it, and sign the bill,” she said.

The bill includes $1.6 billion in funding for construction of a border wall, but that number is far short of the $25 billion in long-term funding that the administration sought, and Democrats also won tight restrictions on how that money can be spent.

Despite weeks of negotiations, Democrats were unable to secure protections for young undocumented immigrants brought to the country as children who had been granted reprieves from deportation under an Obama-era directive. Trump announced in September he would end that program, known as Deferred Action for Childhood Arrivals, by March 5. That deadline was effectively nullified by recent court actions.

The legislation includes increased funding for priorities as diverse as arts agencies, the FBI, the IRS and federal apprenticeship programs. It greatly boosts funding to fight the opioid epidemic and orders the Army Corps of Engineers to keep working on trying to keep Asian carp, an invasive species, out of the Great Lakes.

Prodded by Trump, Republicans eliminated some provisions favoring the $30 billion Gateway project, a major New York-area infrastructure program backed by Senate Minority Leader Charles E. Schumer (D-N.Y.). The legislation also includes a fix for a provision in the new GOP tax law that favored grain cooperatives over traditional agricultural corporations. And it incorporates bipartisan legislation meant to improve the National Instant Criminal Background Check System (NICS) for gun buyers.

There were grumbles in all corners of Capitol Hill about the rapid process that has left lawmakers and aides poring through text to see exactly what the bill will do. House GOP leaders waived their own rules requiring any bill coming to the floor to be posted for at least three days, and none of more than a dozen lawmakers surveyed Thursday said they had read the entire bill.

“There’s no way humanly possible to read 2,232 pages,” said Rep. Thomas Massie (R-Ky.), who opposed the bill. “Sometimes they jam you, but they pretend to give you three days to read it. All the veneer is off now.”