WASHINGTON – Brett Kavanaugh was sworn in as the 114th Supreme Court justice in a private ceremony Saturday just hours after the Senate voted to confirm him, solidifying conservative control of the highest court in the land for years to come and ending a bitter battle over his nomination.

The confirmation delivered a major win to President Donald Trump, who defended his embattled nominee when sexual assault accusations were leveled against him. Kavanaugh has denied the accusations.

Trump, speaking at a rally in Topeka, Kansas, called it a "truly historic night" and a "tremendous victory." He added: "What he and his wonderful family endured at the hands of Democrats is unthinkable."

Kavanaugh's confirmation was not just a chance for Republicans to shift the court to the right for what could be decades. It was also a test of how public officials responded to the raw emotions unleashed by the #MeToo movement amid accusations from Christine Blasey Ford that Kavanaugh had sexually assaulted her when they were teens. He said the incident never happened.

That controversy will likely be scrutinized even further with the Nov. 6 midterm elections a month away, giving Democrats have a chance to take control of one or more chambers of Congress.

The anger among Kavanaugh's critics was evident on the steps of the Capitol where hundreds of protesters, many dressed in black garb, had gathered on the steps holding signs and chanting. A cordon of police officers stood in front of the doors.

Capitol Police said they arrested 164 people from among the hundreds of protestors who had gathered. Most, some 150, were arrested on the Capitol's east side.

The final Senate vote was 50-48. Sen. Joe Manchin was the only Democrat to break ranks and vote in favor of him.

Trump congratulated Kavanaugh on Twitter and called him a "great nominee." He signed Kavanaugh's commission to the Supreme Court aboard Air Force One so he could get to work immediately on the court.

Shortly after, Kavanaugh, accompanied by his family, was sworn in by Chief Justice John Roberts Jr. and retired Justice Anthony Kennedy, who Kavanaugh is replacing, during a private ceremony at the Supreme Court. The 6 p.m. ceremony marks the beginning of his lifetime appointment.

He will hear his first cases next week.

Twists and turns

For weeks, Kavanaugh's future had hung in the balance during hours of hearings, FBI investigations into the sexual assault allegations. The remarkable and ugly set of twists and turns that ended with Saturday's vote.

Kavanaugh's path to confirmation became clear Friday afternoon when Sen. Susan Collins, R-Maine, who had been on the fence for months, announced her support in a 45-minute speech on the Senate floor.

"It is when passions are most inflamed that fairness is most in jeopardy," she said. "I will vote to confirm Judge Kavanaugh."

More:Kavanaugh fight caused bitterness, but senators say they'll be friends again — one day

More:Protesters disrupt final vote to confirm Brett Kavanaugh as a Supreme Court justice

More:'Very, very difficult vote': The wavering senators who decided whether Brett Kavanaugh joins the Supreme Court

Sen. Lisa Murkowski of Alaska was the only Republican against Kavanaugh's appointment. She voted as “present” as a collegial gesture for her Republican colleague Sen. Steve Daines, who supports Kavanaugh but is attending his daughter's wedding Saturday.

The gesture did not affect the outcome of the final vote but changed the tally to 50-48 in favor of Kavanaugh's confirmation.

Kavanaugh's confirmation was marked by mudslinging from both sides that divided the nation even deeper, but there was one thing both Democrats and Republicans agreed one: It was an ugly process that shouldn't be repeated.

Majority Leader Mitch McConnell and Minority Leader Chuck Schumer offered remarks moments before the final votes were cast.

Schumer, speaking first, said the nomination from start to finish "has been one of the saddest moments in the history of the Senate."

"Truly, Judge Kavanaugh's confirmation is a low moment for the Senate, for the court and for the country," he said.

McConnell seemed to agree. He said Kavanaugh’s record was one that "speaks for itself" and the ugly process showed his patience and humility. McConnell said the bitterness “fanned the flames” of partisan divisions throughout the country.

As the votes were cast, many senators sat silently with their hands across their laps. There were no cheers or applause at the conclusion. Some senators did hug or pat one another on the back.

The atmosphere outside the Capitol differed. Protesters held signs reading "Kava Nope" and "Shame, Collins," the latter a reference to the announcement by Collins that she planned to vote in support of the controversial Kavanaugh. Many of the protesters said they felt powerless but vowed that next month's midterms would change that.

Before Vice President Mike Pence called for the first vote, protesters in the Senate angrily began yelling and were dragged out of the chamber by police.

“I do not consent,” a woman could be heard screaming more than a minute after she was taken away.

“I’m a mother,” one woman shouted.

“I’m a patriot,” another said.

Pence, who is also president of the Senate, had to ask the sergeant at arms to restore order in the gallery at least a half dozen times.

Themes for the midterms

Both Republicans and Democrats expect the Kavanaugh decision to be a central theme in the midterm elections.

Trump's promise during his 2016 campaign to put conservatives on the Supreme Court reinforced his support among Republicans.

In 2018, Democrats hope to ride to a "blue wave" of anger over Trump and Kavanaugh that could flip control of Congress. But Republicans believe the battle over Kavanaugh will help energize their voters, too.

Democrats are seen as having a solid chance to captured the House, fueled in part by women voters who are upset over Kavanaugh and dislike Trump. But taking over the Senate is likely to be a lot tougher. Democrats are defending multiple seats in states Trump easily carried in that chamber. In those states, the Kavanaugh vote could help Republicans.

More:A reminder on where Brett Kavanaugh stands on controversial issues

More:$3 million raised for Sen. Susan Collins' opponent amid outcry on Kavanaugh vote

Opinion:Rejuvenated Republicans rediscover unity in litmus-test Brett Kavanaugh confirmation fight

Trump stepped into the political battle over the confirmation as allegations piled up against Kavanaugh.

White House aides had initially taken a more cautious approach, advising the president to tread carefully around a controversy that may still sour suburban women and independent voters. But in recent days Trump changed tack, viewing an outcry over the last-minute allegations of sexual assault against Kavanaugh as a way to drive turnout.

At a Minnesota rally on Thursday, Trump launched his latest rhetorical attack on the political storm surrounding Kavanaugh's confirmation by saying Democrats were "trying to destroy" the Court of Appeals judge and predicting they would pay a price in the November elections.

"Their rage-fueled resistance is starting to backfire," Trump told the audience, which responded with chants of Kavanaugh's name. "These people are loco."

Kavanaugh’s nomination always was destined to become a partisan battleground because of the justice he was picked to replace: Anthony Kennedy, the Supreme Court’s swing vote, who had sided with his liberal colleagues on issues such as abortion, affirmative action and gay rights. Kennedy, 81, retired after three decades in the middle of the court’s ideological battles.

Contributing: Richard Wolf, Eliza Collins, Maureen Groppe, John Fritze, David Jackson, Associated Press