Updated

The final, frenetic hours of the fiscal cliff negotiations featured far more of a desperate near-miss than has previously been reported.

An official close to the talks revealed that on Sunday almost all hope seemed to be lost and that both parties contemplated giving up any chance of stopping the sequester and focusing instead on just tax changes.

It was saved by around-the-clock negotiations between Vice President Joe Biden and Senate Majority Leader Mitch McConnell as well as an Oval Office meeting President Obama had with his staff that started Sunday night and dragged on until almost 2am leading into New Year's Eve.

"It was all sort of a blur," the official said of the series of meetings and phone calls -- offers and counter offers -- leading up to the final deal.

The deal which was passed Monday night by the Senate and Tuesday night by the House, is now on its way to Obama's desk for a signature. The president has said he will sign it.

After Friday's critical meeting at the White House, where the President agreed the Senate leaders should try a desperate late-hour attempt to salvage a deal, McConnell quickly sent the White House his first offer later that night.

The McConnell pitch was a non-starter for the President for several reasons. It set the threshold for tax increases at $750,000 in income per year, had absolutely no extension of unemployment insurance, and included the so-called "chained CPI" -- an adjusted way to calculate government benefits like Social Security that Democrats have resisted.

That first McConnell offer also wanted to continue the Sens. Jon Kyl, R-Ariz., and Blanche Lincoln, D-Ark., approach to the estate tax that Democrats did not like, and it offered to pay down the sequester by means testing Medicare -- a major poison pill to Democrats.

"The final deal was a lot more like the President's approach" than the McConnell approach, the official close to the talks said with satisfaction about the deal the administration was eventually able to cut.

Yet it took many more offers and counter-offers to get there.

On Saturday morning the President, working through Majority Leader Harry Reid, made his first counter to McConnell.

It was a major low-ball offer, with the President saying he would only move from $250,000 to $275,000 on the tax threshold. He also brushed aside the means testing for Medicare and brought extended unemployment insurance back in to the mix.

The two sides exchanged more offers through Saturday into Sunday, though it was clear they were far apart.

The official said the situation was so bad Sunday morning that both sides had basically agreed that it was simply too late for them to figure out how to fix the sequester and it would be more fruitful to only focus for now on trying to settle issues like taxes.

The official said with "hopes still bleak" later on Sunday, McConnell made a move that changed everything.

McConnell suggested to Reid that it would be more productive for the Republican leader to work directly with Biden, an old friend whom he had worked with before.

After the initial Biden-McConnell contact, the Republican leader came down to the neighborhood of $550,000 for the tax threshold in an offer on Sunday night.

At about 8pm on Sunday, the President met in the Oval Office with his senior staff and decided that with the clock ticking it was time to put what would essentially be his final offer on the table.

In the middle of the huddle, Biden called McConnell after midnight to keep their line of communication open.

The President's team met until about 2am on Monday and came up with their bright lines on what absolutely had to be in a final deal.

That included the sequester being shut off at some capacity. The President wanted to stop the sequester for a full year, but that would mean coming up with a combo of spending cuts and new revenue of about $120 billion. Figuring that would be the biggest sticking point, and would not be settled until the end.

The President's other bright lines were that he would not go beyond $450,000 for the tax threshold. He also did not want to pay for a one-year extension of unemployment benefits.

As the President and his team wrapped up at 2am Monday, they sent the offer up to Capitol Hill with Rob Nabors, his chief Congressional liaison.

Nabors worked through the wee hours of Monday morning with Senate Democratic aides to actually draft the legislation. He never got to sleep, only stopping home on Monday briefly to change his clothes and get back to the White House.

Biden and McConnell touched base again just after 6am on Monday, as the differences kept narrowing.

Meanwhile throughout Monday, the President spoke by phone with Reid and House Democratic Leader Nancy Pelosi to tweak the final details.

It was decided there was not enough time to reach $120 billion in spending cuts and revenue to shut down the sequester for a year, so they settled on reaching $24 billion to stop it for two months.

Around 8:30 p.m., McConnell agreed privately that they had reached a deal. So after the President's final calls to Reid and Pelosi, he sent Biden to Capitol Hill to make a final pitch to Senate Democrats concerned the White House may have conceded too much on taxes.

In the end, Senate Democrats overwhelmingly backed the deal, sold on the idea the President got far more than he gave up by getting $620 billion in tax hikes and a net of only $15 billion in spending cuts.

"The President fulfilled a major campaign promise," the official close to the talks said of raising taxes on the rich.

The official added that Obama "broke the Republicans' backs on a 20-year pledge" not to raise tax rates.

"It is one of the most consequential policy achievements of the last couple decades," the official said.