There was never a doubt in House Minority Leader Nancy Pelosi's mind that if Democrats held together, House Republicans would eventually have to come to her for the votes to reopen the federal government and avert a potentially catastrophic government default.
On Wednesday, after three weeks of chaos in Republican ranks, a rattled bond market and a partial shutdown that cost taxpayers $24 billion, the strategy paid off for the San Francisco Democrat and her party. The Senate voted 81-18 for a deal to reopen the government and raise the federal debt ceiling that was a near-total defeat for Republicans. And the House did the same, voting for the measure in a late-night session that pushed up against a government-default deadline.
President Obama signed the legislation soon afterward.
The man who displaced Pelosi as House speaker after the 2010 elections, Ohio Republican John Boehner, conceded defeat earlier Wednesday, having won little more than plunging poll numbers for the GOP.
"We fought the good fight," Boehner told his fellow Republicans. "We just didn't win."
Freshman Texas Republican Sen. Ted Cruz, who led tea party conservatives into the partial shutdown on a quest to dismantle the Affordable Care Act, the crown of Pelosi's 26-year congressional career, admitted that there was "nothing to be gained" by mounting a procedural fight to block the Senate from voting.
Cruz promised, however, that "this fight" to kill the health care law would continue. The first skirmish could come as soon as January, when Congress must again decide whether to fully fund the government.
When the next fight comes, Pelosi will be in perhaps her strongest position since 2010. Some Republicans concede as much.
Rep. Devin Nunes of Tulare, Calif., said his GOP colleagues who forced the partial shutdown were "lemmings in suicide vests" who "basically empower Nancy Pelosi."
"They just haven't realized yet that's what they do," Nunes said.
The key during the battle that intensified after the partial shutdown began Oct. 1 was a unified House Democratic caucus that in turn provided leverage for Senate Majority Leader Harry Reid, D-Nev., and Obama to resist Republican demands to overhaul or kill the Affordable Care Act.
Among the most important moments for Pelosi came last week, when Republicans brought a series of votes to the floor to reopen only the most-popular parts of the government: national parks, veterans' programs and cancer-drug trials.
The idea was to make Democrats nervous about being seen as voting against the Statue of Liberty and children with cancer. Pelosi, however, largely kept her caucus in line: Although Republicans approved all the piecemeal bills, none gathered more than a handful of Democratic votes, and the Senate slapped them away.
"At the end of the day, we knew Republicans were always going to have to rely on Democratic votes to pass anything responsible that the president was willing to sign and that the Senate would pass," said a House leadership aide.
Finally, on Tuesday morning, Boehner issued his final demand, which by then amounted to minor, "lipstick" changes to a bipartisan Senate deal.
Unable to sell the plan to his own members, Boehner told reporters, "There are a lot of opinions about what direction to go." Pelosi said no House Democrat would help him out, and by evening Boehner had pulled the bill from the floor.
The past two weeks have repaired some of the internal damage that Democrats suffered during the first fight over raising the debt ceiling in 2011, when Pelosi and Reid felt burned by Obama's negotiations with House Republicans that led to deep spending cuts.
Rep. John Garamendi, D-Walnut Grove, Calif., said the GOP loss could alter the terrain for the next budget fight in January.
"The radicals and disruptors didn't win," he said. "They were badly chastened by the shutdown. You only need to look at the polls to understand that."