WASHINGTON -- Brett Kavanaugh was sworn in Saturday night as the 114th justice of the U.S. Supreme Court, after a wrenching debate over sexual misconduct and judicial temperament that shattered the Senate, captivated the nation and ushered in an acrimonious new level of polarization -- now encroaching on the court that the 53-year-old judge may well swing rightward for decades to come.

Even as Kavanaugh took his oath of office in a quiet private ceremony, not long after the narrowest Senate confirmation in nearly a century and a half, protesters chanted outside the court building across the street from the Capitol.

The climactic 50-48 roll call capped a fight that seized the national conversation after claims emerged that he had sexually assaulted women three decades ago -- allegations he emphatically denied. Those accusations transformed the clash from a routine struggle over judicial ideology into an angry jumble of questions about victims' rights, the presumption of innocence and personal attacks on nominees.

His confirmation provides a defining accomplishment for President Donald Trump and the Republican Party, which found a unifying force in the cause of putting a new conservative majority on the court. Before the sexual accusations grabbed the Senate's and the nation's attention, Democrats had argued that Kavanaugh's rulings and writings as an appeals court judge had raised serious concerns about his views on abortion rights and a president's right to bat away legal probes.

Trump, flying to Kansas for a political rally, flashed a thumbs-up gesture when the tally was announced and praised Kavanaugh for being "able to withstand this horrible, horrible attack by the Democrats." He later telephoned his congratulations to the new justice, then at the rally returned to his own attack on the Democrats as "an angry left-wing mob."

Like Trump, senators at the Capitol predicted voters would react strongly by defeating the other party's candidates in next month's congressional elections.

"It's turned our base on fire," declared Senate Republican leader Mitch McConnell of Kentucky. But Democratic leader Chuck Schumer of New York forecast gains for his party instead: "Change must come from where change in America always begins: the ballot box."

The justices themselves made a quiet show of solidarity. Kavanaugh was sworn in by Chief Justice John Roberts and the man he's replacing, retired Justice Anthony Kennedy, as fellow Justices Samuel Alito, Clarence Thomas, Ruth Bader Ginsburg and Elena Kagan looked on -- two conservatives and two liberals.

Still, Kagan noted the night before that Kennedy has been "a person who found the centre" and 'it's not so clear we'll have that' now.

Noisy to the end, the Senate battle featured a call of the roll that was interrupted several times by protesters shouting in the spectators' gallery before Capitol Police removed them. Vice-President Mike Pence presided, his potential tie-breaking vote unnecessary.

Trump has now put his stamp on the court with his second justice in as many years. Yet Kavanaugh is joining under a cloud. Accusations from several women remain under scrutiny, and House Democrats have pledged further investigation if they win the majority in November. Outside groups are culling an unusually long paper trail from his previous government and political work, with the National Archives and Records Administration expected to release a cache of millions of documents later this month.

Kavanaugh, a father of two, strenuously denied the allegations of Christine Blasey Ford, who says he sexually assaulted her when they were teens. An appellate court judge on the District of Columbia circuit for the past 12 years, he pushed for the Senate vote as hard as Republican leaders -- not just to reach this capstone of his legal career, but in fighting to clear his name

After Ford's allegations, Democrats and their allies became engaged as seldom before, though there were obvious echoes of Thomas' combative confirmation over the sexual harassment accusations of Anita Hill, who worked for him at two federal agencies. Protesters began swarming Capitol Hill, creating a tense, confrontational atmosphere that put Capitol Police on edge.

As exhausted senators prepared for Saturday's vote, some were flanked by security guards. Hangers and worse have been delivered to their offices, a Roe v. Wade reference.

Some 164 people were arrested, most for demonstrating on the Capitol steps, 14 for disrupting the Senate's roll call vote.

McConnell told The Associated Press in an interview that the "mob" of opposition -- confronting senators in the hallways and at their homes -- united his narrowly divided GOP majority as Kavanaugh's confirmation teetered and will give momentum to his party chances this fall.

Beyond the sexual misconduct allegations, Democrats raised questions about Kavanaugh's temperament and impartiality after he delivered defiant, emotional, testimony to the Senate Judiciary Committee where he denounced their party.

Schumer said Kavanaugh's "partisan screed" showed not only a temperament unfitting for the high court but a lack of objectivity that should make him ineligible to serve. At one point in the hearing, Kavanaugh blamed a Clinton-revenge conspiracy for the accusations against him.

The fight ended up less about judicial views than the sexual assault accusations that riveted the nation and are certain to continue a national debate and #MeToo reckoning that is yet to be resolved.

Republicans argued that a supplemental FBI investigation instigated by wavering GOP senators and ordered by the White House turned up no corroborating witnesses to the claims and that Kavanaugh had sterling credentials for the court. Democrats dismissed the truncated report as insufficient.

In the end, all but one Republican, Sen. Lisa Murkowski of Alaska, lined up behind the judge. She said on the Senate floor late Friday that Kavanaugh is "a good man" but his "appearance of impropriety has become unavoidable."

In a twist, Murkowski voted "present" Saturday as a courtesy to Republican Kavanaugh supporter Steve Daines, who was to walk his daughter down the aisle at her wedding in Montana. That balanced out the absence without affecting the outcome, and gave Kavanaugh the same two-vote margin he'd have received had both lawmakers voted.

It was the closest roll call to confirm a justice since 1881, when Stanley Matthews was approved by 24-23, according to Senate records.

As the Senate tried to recover from its charged atmosphere, Murkowski's move offered a moment of civility. "I do hope that it reminds us that we can take very small steps to be gracious with one another and maybe those small gracious steps can lead to more," she said.

Republicans control the Senate by a meagre 51-49 margin, and announcements of support Friday from Republicans Jeff Flake of Arizona and Susan Collins of Maine, along with Democrat Joe Manchin of West Virginia, locked in the needed votes.

Manchin was the only Democrat to vote for Kavanaugh's confirmation. He expressed empathy for sexual assault victims, but said that after factoring in the FBI report, "I have found Judge Kavanaugh to be a qualified jurist who will follow the Constitution."

A procedural vote Friday made Saturday's confirmation a foregone conclusion. White House Counsel Don McGahn, who helped salvage Kavanaugh's nomination as it teetered, sat in the front row of the visitors' gallery for the vote with deputy White House press secretary Raj Shah.

Senators on both sides know they have work to do to put the chamber back together again after a ferocious debate that saw them arguing over the sordid details of high school drinking games, sexual allegations and cryptic yearbook entries.

Sen. John Cornyn of Texas said, "The Senate has been an embarrassment. We have a lot of work to do."

------

Associated Press writers Mary Clare Jalonick, Matthew Daly, Padmananda Rama, Ken Thomas, Catherine Lucey and Mark Sherman contributed to this report.