WASHINGTON — Shortly after midnight early Saturday morning, U.S. Rep. Kevin McCarthy officially became House speaker thanks to the help of conservatives such as Georgia Congressman Andrew Clyde who had previously opposed him.

It took 15 rounds of voting for it to happen, four of them on Friday. It was the first time the speaker’s race required multiple ballots since 1923 and the fifth-longest contest in U.S. history.

The House took a break of several hours between the 13th and 14th attempts, allowing time for renewed talks with six holdouts. But that 14th vote did not bring a different result; McCarthy failed to reach a majority by a single vote.

As the math became clear, an intense and nearly physical lobbying effort unfurled live on television. Members, including McCarthy, implored Florida Rep. Matt Gaetz to change his vote. One lawmaker, Rep. Mike Rogers of Alabama, appeared to lunge toward Gaetz and was physically restrained.

With a sense of defeat in the air, House Republicans said they would adjourn for the weekend. But Gaetz and others struck a deal, and a 15th cycle of voting commenced around 11:30 p.m.

This time, all six of the remaining anti-McCarthy holdouts voted “present,” lowering the threshold McCarthy needed and allowing him to reach the majority needed to become speaker.

Clyde had flipped to McCarthy’s camp earlier in the day and voted in his favor during all four cycles of voting Friday.

The Athens Republican was initially among a group of 20 conservative members who opposed McCarthy during the first 11 rounds. Thirteen of them backed the Californian during the 12th cycle of voting, which took place at noon Friday, and an additional lawmaker who had voted “present” for several rounds also supported McCarthy.

A 14th lawmaker who had opposed McCarthy voted for him during the 13th round of votes.

In the 14th cycle, which began at 10 p.m., two of the remaining six holdouts voted “present”: Gaetz and Colorado Rep. Lauren Boebert. That lowered the threshold needed for McCarthy to reach a majority.

But the four remaining anti-McCarthy lawmakers still picked alternative candidates, two for Ohio Rep. Jim Jordan and two for Arizona Rep. Andy Biggs.

McCarthy received a total of 216 votes in the 14th round, compared with 212 for Democratic Leader Hakeem Jeffries. But 217 was the necessary threshold to become speaker.

The House Republicans who support McCarthy, which at that time consisted of all but a handful, appeared stunned. Once Gaetz indicated he could vote another way, their demeanor was jubilant and that continued throughout the 15th and final voting round.

Clyde tied his support for McCarthy to the results of negotiations Thursday night and Friday morning. McCarthy agreed to cap spending, give members 72 hours to review bills before a final vote, and at any time a single member can call for a vote to have him removed as speaker.

After Clyde and the others switched their votes to McCarthy, their GOP colleagues rewarded them with standing ovations. Clyde is the sole Georgia Republican who opposed McCarthy’s bid for speaker.

Yet, he’s also been a beneficiary of McCarthy’s financial support. McCarthy’s political committee donated $25,000 to Clyde during the past two election cycles. Federal disclosure reports show that Clyde also created Carrier PAC in September, a fundraising committee operated jointly with the National Republican Campaign Committee, the McCarthy-aligned House GOP’s campaign arm.

The Atlanta Journal-Constitution also confirmed that McCarthy flew to Georgia in October and held a private fundraiser for Clyde in Buckhead. One attendee said Clyde kept the event “very hush” to avoid backlash from conservative hardliners.

Rep. Marjorie Taylor Greene, a key McCarthy ally, said Clyde was effusive in his praise for the GOP leader during another fundraiser for House candidate Chris West held shortly before the midterm.

Clyde even referred to him as “Speaker McCarthy,” she said.

“I think it’s a bad look,” Greene said. “I don’t think that’s right.”

Although Clyde has appeared to have a cordial working relationship with McCarthy, he rarely aligned himself with the Republican leader publicly. But on Friday he said he was supporting McCarthy as an act of good faith based on the offer he made to a group of dissenters.

Staff writer Greg Bluestein contributed to this article.