House GOP 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’s hard-won agreement with President Barack Obama encountered immediate resistance when presented to Republican House members on Monday night.

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

And by keeping the government financed through Sept. 30, 2017, the agreement 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 the GOP-led Congress.

House GOP leaders officially released the measure just before midnight Monday in preparation for a vote on Wednesday. A bitterly divided Congress approved a stopgap spending bill last month.

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, R-Calif., told Republicans, according to Rep. David Jolly, R-Fla., as the leadership sought to rally support for the emerging deal.

A chief selling point for GOP 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.

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 that are a byproduct of a 2011 budget and debt deal and the failure of Washington to subsequently tackle the government's fiscal woes. GOP 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 percent cut in Medicare payments to doctors through the end of a 10-year budget.

There's also a drawdown from the Strategic Petroleum Reserve, reforms to crop insurance and savings reaped from a Justice Department funds for crime victims and involving assets seized from criminals.

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 Sen. Patty Murray, D-Wash., that eased automatic spending cuts for the 2014–15 budget years. A lot of conservatives disliked that measure.

The deal, which would apply to the 2016–17 budget years, would make good on a promise Boehner made in the days after announcing his surprise resignation from Congress last month. He said at the time, “I don't want to leave my successor a dirty barn. I want to clean the barn up a little bit before the next person gets there.”

The Associated Press