Republican Kevin McCarthy was elected as the new speaker of the United States House of Representatives in a dramatic post-midnight ballot on Saturday, after days of intense negotiations and a series of humiliating defeats to finally capture the gavel on a historic 15th attempt.
McCarthy, 57, needed a simple majority to be elected as the speaker, who presides over the business and is second in line to the presidency.
He defeated 52-year-old Hakeem Sekou Jeffries by 216 to 212 votes, in the 15th round of votes that went past midnight.
McCarthy replaces 82-year-old Nancy Pelosi of the Democratic Party, which lost the majority in the House after the November 8 midterm elections. The Republicans won 222 seats in the 435-member House against 212 seats secured by the Democrats.
President Joe Biden congratulated McCarthy on his election as the Speaker and said that this was a time to govern responsibly.
"This is a time to govern responsibly and to ensure that we're putting the interests of American families first," he said.
"(First Lady Dr) Jill (Biden) and I congratulate Kevin McCarthy on his election as Speaker of the House. The American people expect their leaders to govern in a way that puts their needs above all else, and that is what we need to do now," he said.
Biden said he was prepared to work with Republicans, adding that voters made clear that they expect Republicans to be prepared to work with him as well.
"Now that the leadership of the House of Representatives has been decided, it is time for that process to begin," he said.
In his maiden speech as Speaker, McCarthy said he will look into the issue of public debt and pledged that the House will address the 'rise of the Chinese Communist party'.
"We will address America's long-term challenges: the debt and the rise of the Chinese Communist Party. The Congress must speak in one voice on these issues," he said.
"As for the Chinese Communist Party, we will create a bipartisan Select Committee on China to investigate how to bring back the hundreds of thousands of jobs that went to China. Then we will win this economic competition," he said, evoking applause from the lawmakers.
McCarthy said this moment calls for restoring trust within the country, with each other.
"In that spirit, I will work with anyone, everyone who shares our passion to deliver a better future for the nation. I hope you'll join me as a Congress can only operate if we cooperate," he said.
McCarthy opened his first speech with a nod to the many rounds of voting to secure the victory.
"That was easy, huh?" he joked, adding, "I never thought we'd get up here."
He told his Congressional colleagues that his father always told him it's not important how one starts.
"It's how you finish. And now we need to finish strong for the American people," he asserted.
McCarthy becomes 55th House speaker after the fifth-longest contest in history.
The longest vote in US history took place in 1855, lasting 133 rounds over two months.
Earlier, a beaming McCarthy hugged members of his leadership team and allies who stood with him throughout the days-long saga.
Cheers broke out in the chamber and the galleys above, where family members watched the vote unfold.
After weeks of negotiating and days of deadlock, it took 15 rounds of voting for McCarthy to secure enough votes from Republican hardliners.
The Republican leader was able to muster a majority from the lawmakers present on the floor only after six of his party rebels voted 'present', which brought down the magic number from 218 to 215 votes.
McCarthy won the gavel after 15 rounds of voting held over five days, making it the longest election for the speaker.
Congressman Matt Gaetz, one of his fiercest critics and opponents, refused to vote in favour of McCarthy in the 14th round and also in the 15th round.
Gaetz, however, moved his vote from against McCarthy to 'present', and so did five other Republican lawmakers.
In the 14th round, there were some last-minute floor negotiations in front of the cameras, when McCarthy walked up to Gaetz pleading for his vote.
This was followed by some angry exchange of words between supporters of McCarthy and Gaetz.
Congressman Richard Hudson was seen pulling his party colleague Mike Rogers, as he confronted Gaetz, during the 14th round of voting.
In the previous 13 rounds -- two of which were held earlier in the day - McCarthy had some frustrating and embarrassing moments as he was opposed by a group of 20 lawmakers from his own party, mostly from the ultra-conservative House Freedom Caucus.
It was only in the 12th and 13th rounds that more than a dozen of those Republican naysayers switched their votes.
"Of the more than 50 speakers of the House, 15 have been in McCarthy's situation: needing multiple elections to win the gavel," NBC News said, reflecting the historic and unprecedented nature of the election of a House speaker this year.
There have been only four House speaker races that have gone so far in the past.
As a powerful Speaker of the House, McCarthy would be in a position to play a key role in deciding the national policies, including those related to the budget.
In this position, McCarthy is also third in the line of succession after President Biden and Vice President Kamala Harris.
He represents California and previously served as the House minority leader. He has already vowed to launch multiple investigations into President Biden and his administration.
The 118th Congress has five Indian Americans as members of the House of Representatives.
They are all from the Democratic Party - Dr Ami Bera, Raja Krishnamoorthi, Ro Khanna, Pramila Jayapal and Shri Thanedar.
All of them voted for Jeffries in the 14th round. Jeffries has made history, becoming the first Black lawmaker to lead a party in Congress.
The New York congressman will lead Democrats in the House, succeeding Pelosi, who served as the speaker in the prior session of Congress.
Jeffries marks the end of an era -- and the start of a new one -- for Democrats as he takes up his new position.
"I just look forward to the opportunity to do good for the greatest number of people possible for as long as I have the opportunity to do so and can operate at the highest level," he previously told CNN.
The drama of not electing a speaker has very real consequences.
The House cannot conduct any business, including swearing in new members until a speaker is chosen.
Without a speaker, lawmakers can't form committees, advance legislation, or participate in intelligence briefings.
Friday's standoff coincides with the second anniversary of the January 6, 2021 attack on the US Capitol, when supporters of then-President Donald Trump breached the building with the aim of stopping Congress from certifying the 2020 presidential election in favour of President Biden.