Washington — Negotiators for President Biden and Republican congressional leaders on Saturday night reached an 11th-hour agreement in principle to raise the debt ceiling, House Speaker Kevin McCarthy confirmed. Both sides came to the tentative agreement after weeks of delays that rattled markets and raised fears about a catastrophic default.

Biden and McCarthy had spoken by phone earlier Saturday evening, CBS News learned, after hours of marathon negotiations.     

“I just got off the phone with the president a bit ago,” McCarthy tweeted. “After he wasted time and refused to negotiate for months, we’ve come to an agreement in principle that is worthy of the American people.”     

McCarthy had been at the Capitol all weekend, and he told reporters Saturday morning that he was “optimistic” a deal would be reached. 

CBS News learned that the agreement raises the debt limit for two years and keep non-defense spending flat, at 2023 fiscal year levels, for two years as well. Non-defense spending would then increase by 1% in the 2025 fiscal year. 

The deal also fully funds medical care for veterans, including the PACT Act, which was passed last year and expands benefits to 3.5 million veterans who have been exposed to toxic burn pits during wartime, CBS News learned. 

The breakthrough came just days before the government was expected to exhaust the ability to pay its bills, an unprecedented event that would send shockwaves through the global economy. Treasury Secretary Janet Yellen on Friday pushed back the estimated deadline on the so-called “x-date” from June 1 to June 5, giving negotiators some breathing room.

Republican House leadership has informed rank-and-file GOP members they would hold a conference call at 9:30 p.m. Eastern Saturday to update them on the negotiations, two sources familiar with the talks told CBS News.   

The details of the agreement were not immediately clear and the risk of default remains, given the slim margin for error for crafting and passing the bill in Congress. Lawmakers must now transform the agreed-upon provisions into actual legislative text, a process that typically takes several days. It must then pass both chambers of Congress, overcoming expected opposition from members of both parties. 

Conservatives have demanded drastic spending cuts in exchange for raising the debt ceiling, which Democrats have said should be raised without conditions. Passing the agreement in the House will likely require the votes of dozens of Democrats to offset conservative Republicans who vote against the measure. Some progressives have also vowed to oppose any bill that cuts spending too deeply. 

The House and Senate are both recessed for the Memorial Day holiday, further complicating the timeline for passing a bill. Congressional leaders have warned their respective members to be prepared to return to Washington on short notice to vote on a deal.

White House officials and McCarthy’s representatives had been meeting at the Capitol and White House on-and-off for days to hammer out the details of a deal since Mr. Biden reengaged on the issue, after insisting he would not negotiate on raising the debt ceiling.

House Republicans passed a bill in April that represented their opening negotiating position. That legislation would have lifted the debt limit by $1.5 trillion or until the end of March 2024, and cut federal spending to the tune of $4.5 trillion. Democrats accused Republicans of trying to slash programs for those in need.

McCarthy and Biden met several times to try to resolve their differences when talks appeared to reach an impasse, and both described their meetings as “productive.” But hammering out details they could agree on and sell to their constituencies proved difficult.

Before a deal was struck, for instance, Republican Sen. Mike Lee of Utah said he would “use every procedural tool at my disposal to impede a debt-ceiling deal that doesn’t contain substantial spending and budgetary reforms.”

Yellen has repeatedly warned that early June is when the U.S. will likely be unable to pay its bills. 

“It seems almost certain that we will not be able to get past early June,” Yellen said during a virtual appearance with the Wall Street Journal’s CEO Council Summit on Wednesday.

Ed O’Keefe and Zak Hudak contributed to this report.