It took House Speaker Nancy Pelosi nearly three months of wrangling the progressive and centrist factions in her caucus, last-minute delaying of votes, two Capitol Hill visits from President Joe Biden, a decoupling of the two halves of Democrats’ "Build Back Better" legislative agenda, and a bill-saving bump from 13 Republicans to pass a $1.2 trillion infrastructure bill in a late-night vote.

The saga demonstrates what a tenuous hold the speaker has over the House Democratic Caucus as she navigates its razor-thin majority, having only three votes to spare before Republican votes are needed to pass legislation.

The California Democrat's tricky political chessboard was set in June, when Pelosi said that she would not hold a vote on an infrastructure bill, funding hard infrastructure projects such as roads and broadband, until the Senate also passed a go-it-alone sweeping “human infrastructure” social spending package, which included provisions such as money for preschool and expanded Medicaid coverage. She later softened that stance, but dozens of progressive Democrats didn’t let go of it.

A bipartisan group of 10 senators crafted the infrastructure bill, dubbed the Infrastructure Investment and Jobs Act. In August, it passed in the Senate with the support of 19 Republicans, including Senate Minority Leader Mitch McConnell.

WHAT’S NEXT FOR DEMOCRATS’ $1.85 TRILLION BUILD BACK BETTER BILL AFTER INFRASTRUCTURE PASSED

Pelosi’s tying the two bills together caused friction, though.

Conservatives in the House called the infrastructure bill a “Trojan horse” for the larger spending bill, which started at $3.5 trillion over 10 years. House Republican leadership eventually opted to whip votes against the infrastructure bill, arguing that it was no longer a stand-alone bill. That left Pelosi not able to count on Republicans to make up for any substantial Democratic defections.

Centrist House Democrats in August, including Rep. Josh Gottheimer of New Jersey, pushed Pelosi to hold an immediate vote on the infrastructure bill, arguing that their states and communities could use the money. Members of the Congressional Progressive Caucus, led by Washington Rep. Pramila Jayapal, took the opposite approach, wanting to use the infrastructure bill as leverage to ensure that their top priorities were in the bill.

Democrats are using a special reconciliation process that allows them to push the "Build Back Better" bill through the Senate without the need for Republican votes, all of whom are expected to oppose the bill. That means buy-in is needed from all 50 senators who caucus with Democrats, giving centrists Manchin and Arizona Sen. Kyrsten Sinema much power to craft the scope of the legislation.

August ended with Biden paying an Oct. 1 visit to Capitol Hill to lobby for his agenda and Pelosi being forced to delay a planned vote on the infrastructure bill due to progressive opposition, a blow to centrists who had negotiated a Sept. 27 deadline for a vote on the bill.

Negotiations and a Democratic standoff continued through October. But at the end of the month, there seemed to be a breakthrough. Progressives agreed to downsize from the original $3.5 trillion "Build Back Better" bill price tag to just under $2 trillion, with items such as universal community college taken out of Biden’s second-draft negotiated framework.

Pelosi put the bill on the schedule for Oct. 28, and Biden again traveled to Capitol Hill to lobby for the bill. Leaders hoped that having the new framework would push the caucus to deliver a win for Biden.

But that was not good enough for progressives, who again withheld their votes from the bill and forced Pelosi to again delay a scheduled vote on it. The caucus’s demands, though, started to soften: Instead of a Senate vote on the "Build Back Better" bill, they sought back-to-back House votes on both bills (despite their knowing that the "Build Back Better" bill would likely change more in the Senate to appease Manchin and Sinema).

Elections in Virginia and New Jersey last week that showed big wins for Republicans gave Democrats extra incentive to deliver some much-needed good news for Biden, whose approval numbers have sagged. Luckily, negotiations had made much progress in the House.

House Democrats on Friday were scheduled to pass both the infrastructure bill and the "Build Back Better" bill. In a huge milestone, House progressives threw their support behind the move.

But centrist Democrats in the House threw a wrench in the plan, saying that they wanted to see a Congressional Budget Office analysis of the budgetary effects of the bill (or “score”) before passing the legislation.

That led to an hourslong standoff, with Pelosi seeking to deliver Biden a win after Democrats performed poorly in Virginia and New Jersey elections earlier in the week.

Eventually, an agreement was struck: Progressives would vote for the infrastructure bill, the House would have a procedural vote on advancing the "Build Back Better" bill, and the centrist Democrats would commit to voting on the bill next week as long as the budgetary impact was found to be in line with White House estimates.

Five more centrist Democratic representatives signed on to a statement Friday night saying that they would commit to voting for the bill when it gets a Congressional Budget Office score, “but in no event later than the week of November 15th.” If the projection does not match that of the White House, they said, they “remain committed to working to resolve any discrepancies in order to pass the Build Back Better legislation.”

CLICK HERE TO READ MORE FROM THE WASHINGTON EXAMINER

That was enough for the Progressive Caucus to support a Friday "yes" vote on the infrastructure bill. But it was not enough of an assurance for six far-left House Democrats in the “Squad,” six of whom voted against the infrastructure bill.

In the end, Pelosi’s monthslong wrangling of her caucus only delivered her a win because Republicans were not united in opposition to the bill. Thirteen House Republicans made up for the Democratic defections on the infrastructure bill, pushing it to final passage and Biden’s desk.