ByAndrew Taylor and Erica Werner, Associated PressOctober 27, 2015

House Speaker John Boehner of Ohio speaks during a Oct. 21 news conference on Capitol Hill in Washington. Lawmakers are pushing to finalize a sweeping deal to fund the federal government before Boehner leaves Congress at the end of this week.

Washington — House Republican leaders struck a budget deal made with the White House just before midnight Monday aimed at averting a government shutdown and forestalling a debt crisis.

Speaker John Boehner was making one final appeal to restive Republicans: Pass the hard-won agreement with President Barack Obama before Rep. Paul Ryan assumes the speaker's job later this week. But he encountered immediate resistance when he laid out the plan Monday night. His plan is for members to vote on the deal Wednesday.

The budget pact, in concert with a must-pass increase in the federal borrowing limit, would solve the thorniest issues awaiting Ryan, who is set to be elected speaker on Thursday.

The deal would also take budget showdowns and government shutdown fights off the table until after the 2016 presidential election, a potential boon to Republican candidates who might otherwise face uncomfortable questions about messes in the Republican-led Congress.

Congress must raise the federal borrowing limit by Nov. 3 or risk a first-ever default, while money to pay for government operations runs out Dec. 11 unless Congress acts. The emerging framework would give both the Pentagon and domestic agencies two years of budget relief of $80 billion in exchange for cuts elsewhere in the budget.

Outlined for rank-and-file Republicans in a closed-door session Monday night, the budget relief would total $50 billion in the first year and $30 billion in the second year.

"Let's declare success," House Majority Leader Kevin McCarthy told Republicans, according to Rep. David Jolly as the leadership sought to rally support for the emerging deal.

A chief selling point for Republican leaders is that the alternative is chaos and a stand-alone debt limit increase that might be forced on Republicans. But conservatives in the conference who drove Boehner to resign were not ready to fall in line.

"This is again just the umpteenth time that you have this big, big, huge deal that'll last for two years and we were told nothing about it," said Rep. John Fleming of Louisiana.

"I'm not excited about it at all," said Rep. Matt Salmon, an Arizona Republican. "A two-year budget deal that raises the debt ceiling for basically the entire term of this presidency."

The measure under discussion would suspend the current $18.1 trillion debt limit through March 2017.

The budget side of the deal is aimed at undoing automatic spending cuts which are a byproduct of a 2011 budget and debt deal and the failure of Washington to subsequently tackle the government's fiscal woes. Republican defense hawks are a driving force, intent on reversing the automatic cuts and getting more money for the military.

The focus is on setting a new overall spending limit for agencies whose operating budgets are set by Congress each year. It will be up to the House and Senate Appropriations committees to produce a detailed omnibus spending bill by the Dec. 11 deadline.

The tentative pact anticipates designating further increases for the Pentagon as emergency war funds that can be made exempt from budget caps. Offsetting spending cuts that would pay for domestic spending increases included curbs on certain Medicare payments for outpatient services provided by hospitals and an extension of a 2-percentage-point cut in Medicare payments to doctors through the end of a 10-year budget.

Negotiators looked to address two other key issues as well: a shortfall looming next year in Social Security payments to the disabled and a large increase for many retirees in Medicare premiums and deductibles for doctors' visits and other outpatient care.

The deal, which would apply to the 2016-17 budget years, resembles a pact that Ryan himself put together two years ago in concert with Democratic Sen. Patty Murray that eased automatic spending cuts for the 2014-15 budget years. A lot of conservatives disliked that measure.

"It is past time that we do away with the harmful, draconian sequester cuts," said Senate Minority Leader Harry Reid. "We must also ensure that there are equal defense and nondefense increases."

Just days are left for the deal to come together before Ryan is elected Thursday to replace Boehner, R-Ohio, who is leaving Congress under pressure from conservative lawmakers angered by his history of seeking compromise and Democratic votes on issues like the budget.