It played out on two tracks, the struggle to head off a national default. One was for show. The other was for real. That's how most big things happen in Washington.
The final votes were public, not even all that close in the end.
But the crisis was genuine, and the real crisis management took place in private
The tracks finally came together, in the nick of time, when the Senate granted final passage to legislation raising the U.S. debt ceiling, trimming spending and punting the most painful decisions on deficits down the road. President Barack Obama's pen sealed the deal Tuesday afternoon.
Anyone tuned to the capital's ways just knew the negotiations for a debt deal would go down to the final hours and everything that unfolded before that in the public eye was theater, hollow suspense.
The drama was behind the curtains. That's where Republicans and Democrats up and down the chain of authority finally joined in a common cause to stave off a potentially catastrophic default on debt payments.
It's where something truly historic slipped from the grasp of political leaders. Their agreement averts a default but merely delays the hardest choices on taxes and spending.
And it's where Republican Senate leader Mitch McConnell and his staff, cramming down Chinese food Saturday night, broke open a fortune cookie that warned: "You may be spending too much money." A touch of comic relief near the end.
In the voting well of the Senate chamber, the intersection between bluster and bargaining could be seen in the body language of Republican Sen. Olympia Snowe of Maine. Facing a tea party challenge in her re-election fight, she had co-written a newspaper column about how bad the deal taking shape had looked.
That was her conservative face, turned to the audience.
She took her sweet time down the aisle, paused in the well, then looked up to see six senators around her, McConnell's face hovering just over her left shoulder. They didn't need her vote to pass the bill, but they wanted it.
At decision time, she smiled at their attention, demurely lifted a finger, and voted aye.
This was her moderate face, the one that counted Tuesday.
Over days if not weeks, legislative aides worked themselves sick with exhaustion. Coffee spilled on White House carpet during endless hours of bleary-eyed brinkmanship and bargaining.
Breakthrough moments collapsed into familiar but increasingly unaffordable partisan discord, only to be reincarnated when progress mattered the most _ and not a moment sooner.
The stagecraft on both sides was primarily if not purely for campaign consumption: speeches that changed no minds, votes that didn't matter, dead-end detours taken by one party or the other as grist for political ads down the road.
Republicans had to be seen standing firm against higher taxes and for spending cuts sensational enough to appease the right. Democrats spoke as guardians of the social compact _ defenders of Medicare, Social Security, Medicaid and more. That's why one of them called the deal "a Satan sandwich." Stay tuned for much more of that in the lead-up to the 2012 elections.
For a time, it seemed as if the classic battle lines might give way to something new.
Obama and Republican House Speaker John Boehner had been quietly working on the framework of a potentially historic deficit deal that would take on spending, taxes, entitlements _ all of it.
On July 9, Boehner spent the day back home in Ohio, riding his bicycle, putting a new blade on the lawnmower, cutting the grass and talking on the phone with fellow Republicans. Then he called Obama, at the Camp David retreat in the Maryland mountains, to say he could not pull it off.
The news surprised Obama, who was about to hold a meeting of lawmakers at the White House the next day. According to someone familiar with Boehner's end of the call, Obama tried to talk him out of abandoning the big bargain in a call that ran up to 40 minutes.
Weeks of posturing followed, as the backroom horse-trading pressed on in fits and starts. Republicans put forward legislation that satisfied their ideologues but stood no chance of becoming law. Democrats responded in kind. It was a stage dance.
Obama, when with his staff, often worked with his feet up _ on a coffee table, a chair, even the Oval Office's Resolute desk, which he also sat on. He grew ever more urgent in his public remarks.
"We might as well do it now _ pull off the Band-Aid, eat our peas," he said July 11, when the government still had wiggle room on the calendar.
Then four days later: "We're running out of time."
Then four days later: "We're in the 11th hour and we don't have a lot more time left."
Friday, July 22, was supposed to be the day when everyone would know which direction this struggle was heading. It was almost down to the last week before default day.
Obama thought he and Boehner were close. But he and his team knew it was not a good sign when the president could not even get his phone call returned all day. The news started to trickle out in the late afternoon: Boehner was backing out of talks. The speaker called Obama at 5:30 p.m. to tell him no deal.
Within a half hour, the president was out in the White House briefing room, clearly angry. He declared that Boehner had jilted him. Again.
"I've been left at the altar now a couple of times," Obama said, conjuring up one of the odder images of the whole debate. Of Republicans, he added: "Can they say yes to anything?"
For their part, Republicans insisted Obama had to stop saying yes to higher taxes as part of the fix. He finally did.
Fits and starts defined the rhythm last week, too, as congressional leaders began turning up the heat on malcontents to support whatever deal came together.
It was a painful time to be selling compromises. Part of Boehner's approach, to Republicans who despised the emerging deal, was to say that liberal Democrats despised it even more.
"Barack Obama hates it," he said on the radio. "Nancy Pelosi hates it. Harry Reid hates it."
That was Boehner's public face.
Privately, he told the rank and file: "Get your ass in line. I can't do this job unless you're behind me."
The speaker was right, though. Democratic Rep. Emanuel Cleaver of Missouri called the deal "a sugar-coated Satan sandwich" and Pelosi concurred. "Probably is," she said, "with some Satan fries on the side."
House Majority Whip Kevin McCarthy dished out pizza and persuasion to Republican holdouts who filed into his office to have the riot act read to them. Boehner, who can be both collegial and intimidating, also summoned members to his ceremonial office. Texas Rep. Louis Gohmert came out of his Boehner session still opposed to the deal, but reporting: "I'm bloody and beaten."
Into the weekend, a final round of bluster played out as the Republicans in control of the House and the Democrats holding the Senate rejected each other's partisan bills.
Then, no more show time. It was time to get real.
No-nonsense negotiations proceeded apace starting Saturday afternoon. Vice President Joe Biden and McConnell had worked out most of an agreement on a trigger that would activate automatic spending cuts if a special bipartisan committee could not agree in the fall on how to achieve big further reductions.
In a call Saturday night, Republican aides made a last-ditch effort to include Medicaid among the programs that would face automatic cuts. The White House slapped that down.
Negotiations continued into early Sunday morning, with top White House aides huddled in chief of staff Bill Daley's office. By now, the White House had long caved on including tax increases for the wealthy in the trigger, bowing to the reality that Republicans would never accept it.
By Sunday afternoon, the talks on the White House end had moved from Daley's office to Biden's office to the Oval Office.
About 5 p.m., the president gathered his top economic aides, including Treasury Secretary Timothy Geithner, in the Oval Office to discuss a grim scenario _ how and when Geithner should start telling financial markets and ratings agencies there was no deal to raise the debt ceiling and the U.S. could default.
This contingency had to be discussed even though the two sides were awfully close.
Only one major disagreement remained between Republicans and Democrats, but it was significant. At issue was how far to go to expose the Pentagon to spending cuts.
The ultimate solution originated in the Senate, and it was McConnell who finally pitched it to Biden. He concocted a way to let appropriators spread out spending cuts among all "security" operations, not just the military budget. They would have the flexibility to save money from homeland security, foreign aid and the like, so the knife would not go so deep at the Pentagon.
That worked for Obama. He called Democratic leaders of the House and Senate to get their sign-off as well.
By 8:15 p.m., there was only one other commitment he needed.
From his desk in the Oval Office, Obama placed a call to Boehner.
"Do we have a deal?" Obama asked.
He paused as Boehner responded.
"Congratulations to you too, John," Obama replied before hanging up.
The tone was somber when Obama returned to the briefing room Sunday night to tell the nation and the world that a deal had been reached. Four aides sat to his right. There was one empty seat in the row. Biden slipped in to take it.
No one had been more involved in negotiating with Hill leaders than Biden. He looked the part. He was the only one who hadn't had the time, or felt the need, to put on a blazer for Obama's statement.
When it was done, the president darted out and up a hallway of the West Wing.
Biden joined him, and the two locked arms over each other's shoulders for a moment as they headed into the Oval Office.
It was almost over.
The final votes: 269-161 for the deal in the House on Monday night, 74-26 in the Senate on Tuesday. The ayes and nays were both bipartisan.
. At the White House on Tuesday, as in the Capitol, the weeks had smashed together into what felt like long one day.
In his Rose Garden statement capping the epic showdown, Obama again noted the public's frustration with the town, and did little to hide his own.
"Our economy didn't need Washington to come along with a manufactured crisis to make things worse," Obama said. "That was in our hands."
Obama signed the bill at his desk alone, unusual for major legislation. Afterward, the West Wing felt instantly quieter. The chief of staff privately encouraged the members of the president's team to start reconnecting with their families.
On Wednesday, Obama took some of his hardest-working aides on the debt showdown to lunch at Good Stuff Eatery on Capitol Hill, where the Prez Obama Burger is surely not made by the devil.
Associated Press writers Ben Feller, Julie Pace, Laurie Kellman and Nancy Benac contributed to this report.