House Majority Leader Kevin McCarthy of Calif., center, leaves the House Chamber after the House approved a stopgap spending bill to keep the federal government open Sept. 30, 2015. (Andrew Harnik/AP)

Congress voted Wednesday to extend funding for the federal government through early December, averting what a week ago appeared to be a likely government shutdown.

The legislation passed with little drama and several hours to spare, but the mood over the Capitol was not that of a disaster avoided but rather of a disaster delayed, with lawmakers of both parties saying they were wary of a holiday-time reprise of contentious battles over government spending, abortion and other divisive issues.

The stopgap spending bill, which passed the Senate 78 to 20 and cleared the House 277 to 151, continues current funding levels through Dec. 11 and sets the stage for negotiations between congressional Republican leaders, who want to hew to strict caps on nondefense discretionary spending, and President Obama and Democrats, who want higher levels.

A failure to agree on new thresholds would not only raise the possibility of a Dec. 12 shutdown but would also herald the imposition of budget “sequestration” in the new year, a regime of sharp spending cuts split between the military and the rest of the federal government.

Meanwhile, Republican demands to end Planned Parenthood’s access to Medicaid reimbursements and federal health-care grants, which nearly prompted a shutdown ahead of Wednesday’s midnight deadline, show no sign of abating. And the budget negotiations are taking place in the immediate aftermath of House Speaker John A. Boehner’s resignation announcement, a watershed moment that has emboldened anti-Boehner conservatives and could lead the next speaker to take a tougher line at the bargaining table.

“There could be some really caustic, bitter battles,” said Sen. Orrin G. Hatch (R-Utah), the Finance Committee chairman. “There’s no question it’s going to be harder. . . . Anybody with brains has got to know that to win around here, you have to have a majority, and it takes both sides in this particular case.”

Congressional Republicans have been split between fiscal hawks, who want to stick to the sequester-level spending caps, and defense hawks, who want to exceed those caps on the military side. The latter won out earlier this year when House and Senate Republicans hashed out a budget proposal that boosted defense spending.

But Democrats have insisted for months that any increase in military spending must be matched with an increase in nondefense spending, and the party’s leaders in the Senate have pledged to filibuster any long-term spending bill until a deal is struck.

Republican leaders have only recently indicated that they are willing to begin negotiations. Senate Majority Leader Mitch McConnell (Ky.) has initiated preliminary talks with his party colleagues, who are insisting that any proposed increases be offset by savings elsewhere, according to a Senate Republican aide.

“The negotiations tend to favor people who want to expand and grow government,” said Sen. John Thune (R-S.D.). “And the Democrats clearly are trying to use leverage. They know we want funding for national security; they’re trying to use that to get funding for their domestic programs.”

The biggest obstacle to compromise is certain to be a restless House Republican Conference, now dominated by conservatives who are in no mood to accommodate Obama as he enters his final year in office.

Boehner’s departure announcement Friday, amid rumblings of an impending conservative revolt, kicked off a succession fight where future House GOP leaders are being pressed to take a tougher line.

The influential conservative activist group Heritage Action for America, for instance, on Wednesday called on aspiring House leaders to end Planned Parenthood funding and respect the sequestration caps. “A near-term spending increase would further undermine the party’s claim to fiscal responsibility,” the group said in a memo.

That position has the stalwart backing of a group of about three dozen hard-line conservatives who harried Boehner out of his post. But Wednesday’s vote also showed there is a much larger group of Republicans disinclined to pass a spending bill on bipartisan terms: House GOP members accounted for all 151 votes against the short-term extension.

Minority Leader Nancy Pelosi (D-Calif.) said the tally “highlights the astounding, toxic radicalism of the Republican majority” and called on Congress to “avert further crisis and negotiate a budget that will responsibly end the sequester and meet the needs of the American people.”

The leading candidate to replace Boehner as speaker, Majority Leader Kevin O. McCarthy (R-Calif.), has carefully avoided addressing how he would handle budget negotiations: “Let’s fight,” he said in a Fox News interview Monday, “but let’s make sure we pick the fights to win.”

Sen. Charles E. Schumer (N.Y.), the third-ranking Democratic leader, said it was “hard to paint a scenario where things get better” without Boehner leading negotiations for the House Republicans.

“The question is, what has he promised these 40 off-the-deep-end guys ahead of time?” Schumer said, referring to McCarthy. “That is the $64,000 question. That will determine how the budget goes. If he goes along with their view of shutdown, we got trouble.”

Congress last faced the threat of sequestration two years ago, which resulted in an 11th-hour budget deal between House Republicans and Senate Democrats, then in the majority, to loosen the spending caps for two years.

The White House on Wednesday called for a similar deal. “Republicans have not succeeded and will not succeed in passing budget legislation strictly along party lines,” press secretary Josh Earnest said. “They’ve tried that countless times now. It doesn’t work. They don’t have enough unity within the Republican caucus to advance legislation like that.”

Many conservatives in the House say budget negotiations shouldn’t start until new leaders have been elected because they don’t trust Boehner to reach a deal they can support.

“I feel very strongly that if we blow those budget caps and we go back into the kind of deficit spending that occurred before 2012, that is an untenable position for people like me,” said Rep. Matt Salmon (R-Ariz.), a member of the hard-line Freedom Caucus.

But House Appropriations Committee Chairman Hal Rogers (R-Ky.) said eventually the House will have no choice but to accept a some sort of deal: “We have no choice. We’ve got a divided government. There has to be a conversation.”