Brett Kavanaugh is sworn in as an Associate Justice and his wife Ashley Kavanaugh holds the Bible.

Highlights Brett Kavanaugh was sworn in as the 114th Supreme Court justice

He was confirmed by Senate in 50-48 vote

His confirmation is likely to have an impact in midterm elections

Senate confirmed Brett Kavanaugh as the 114th Supreme Court justice on Saturday by one of the narrowest margins in history amid mass protests, ending a vitriolic battle over his nomination and solidifying a conservative majority on the court.

As a throng of angry demonstrators stood on the steps of the Capitol, the Senate finalized on a near party-line vote of 50 to 48 what will certainly be one of President Donald Trump's most enduring legacies: two Supreme Court justices in two years in an increasingly polarized nation.

The brutal confirmation fight is likely to have far-reaching implications in next month's midterm elections. Republicans are confronting an electrified Democratic base led by women infuriated by the treatment of Christine Blasey Ford, who detailed in emotional testimony last week her allegations that Kavanaugh sexually assaulted her when both were teenagers. Kavanaugh has denied the allegations.

Blasey Ford, wearing glasses and a sober dark blue suit, recounted the alleged assault last week. (File)

Yet Republicans say the battle to get Kavanaugh confirmed - in the face of Democratic opposition and the "mob" of anti-Kavanaugh demonstrators who flooded the Capitol in recent days - only motivated a fractured GOP electorate on a singularly unifying issue for conservatives: the federal judiciary.

"It's been a great political gift for us. The tactics have energized our base," Senate Majority Leader Mitch McConnell, R-Ky., said in an interview Saturday with The Washington Post. "I want to thank the mob, because they've done the one thing we were having trouble doing, which was energizing our base."

Senate Majority Leader Mitch McConnell, a Republican from Kentucky, walks through the U.S Capitol after voting in Washington, D.C., on Saturday.

Senate Minority Leader Charles Schumer, D-N.Y., delivered a message "to so many millions who are outraged by what happened here . . . vote."

Kavanaugh heads to the Supreme Court significantly scarred from the confirmation fight, which had the echoes of the 1991 battle over now-Justice Clarence Thomas who was accused of sexual harassment by law professor Anita Hill and defended himself in an emotional, high-stakes congressional hearing.

Already, Chief Justice John Roberts Jr. has received more than a dozen complaints of judicial misconduct against Kavanaugh but is not referring them for investigation for the time being. And in a joint appearance on Friday night at Princeton University, their shared alma mater, Justices Elena Kagan and Sonia Sotomayor raised concerns about how the bitter partisan battle over Kavanaugh will affect the court's reputation.

"We have to rise above partisanship in our personal relationships," said Sotomayor, who was nominated by President Barack Obama in 2009. "We have to treat each other with respect and dignity and with a sense of amicability that the rest of the world doesn't often share."

The tension surrounding Kavanaugh's nomination continued until the final minutes in the packed Senate chamber, where several protesters were escorted out after disrupting the vote, during which Vice President Mike Pence presided. Over shouts of "Shame! Shame! Shame!" and screams of "I do not consent!" each senator stood at his or her desk to vote - a move generally reserved for historic roll calls.

White House counsel Donald McGahn - one of Kavanaugh's most ardent defenders within the administration - sat in the front row of the public gallery.

Aboard Air Force One, Trump invited reporters to watch the vote and gave a thumbs up when Pence announced the tally. "I think he's going to go down as a totally brilliant Supreme Court justice for many years. Many years," Trump said.

Kavanaugh, who received a congratulatory call from Trump, was sworn in at the Supreme Court Saturday night.

The two-vote margin was the narrowest for a confirmed Supreme Court justice since 1881, when the Senate confirmed Stanley Matthews, a nominee of President James Garfield. The vote reflected the divisiveness of the Trump era, where all but one Democratic senator - Sen. Joe Manchin III, W.Va. - opposed Kavanaugh.

Democrats were enraged by the nominee's partisan criticisms in his Senate defense last week as he cast the opposition to his nomination as retribution for Hillary Clinton's loss in the 2016 presidential election. They questioned whether he had the temperament for the nation's highest court.

Republicans vigorously defended Kavanaugh's character and fitness to serve on the bench and blamed Democrats for the tumultuous battle.

"Democratic leaders did everything in their power to make Judge Kavanaugh's confirmation about anything except his judicial record," Senate Judiciary Committee Chairman Charles Grassley, R-Iowa, said. "When routine process arguments failed, they resorted to outright character assassination."

Kavanaugh, 53, is a veteran of the George W. Bush White House who has served on the District of Columbia Circuit Court of Appeals for a dozen years. He was a top deputy in the office of independent counsel Kenneth Starr in the Clinton administration.

His nomination was fraught with partisan tensions from the start, as he replaced Justice Anthony Kennedy, a Ronald Reagan appointee who nonetheless was a crucial swing vote on landmark decisions involving abortion access and gay rights. His opponents repeatedly warned that Kavanaugh would vote to overturn the 1973 decision Roe vs. Wade, which legalized abortion.

Much of Kavanaugh's records from his tenure in the Bush administration remains obscured from public view - particularly documents from his three years as Bush's staff secretary, one of the senior-most positions in any White House.

But then his nomination collided with the year-old #MeToo movement after Ford detailed her assault allegation to The Washington Post, which she said occurred at a gathering in suburban Maryland in the early 1980s. Two other women have since accused Kavanaugh of misconduct.

Following a hearing that included testimony from both Ford and Kavanaugh, the confirmation vote was delayed a week to allow the FBI to investigate the allegations. Republicans said the FBI report exonerated Kavanaugh, while Democrats argued it was too limited in scope to be enlightening.

In a new statement on a GoFundMe page, Ford said she believed and still believes "that it was my civic duty to come forward, but this is by far the hardest thing I've ever had to do, much harder even than I thought it would be."

Ford's family had reopened the GoFundMe page to cover the costs of security, housing, transportation and other expenses.

In a reminder that Saturday's vote might not be the last word on the accusations, House Minority Leader Nancy Pelosi, D-Calif., said she will file a Freedom of Information Act request to make public the FBI report and other related documents.

After the remaining votes fell into place on Friday, Democrats, in a show of defiance, spent all night making impassioned floor speeches against the nomination and continued into Saturday morning.

Sen. Patty Murray, D-Wash., said that by confirming Kavanaugh, the Senate would be sending a deeply troubling message both to the nation's girls and women - "your experiences don't matter" - but also to its boys and men.

"They can grab women without their consent and brag about it," Murray said. "They can sexually assault women, laugh about it. And they're probably going to be fine. They can even grow up to be president of the United States or a justice on the Supreme Court."

Murray was first elected to the Senate in 1992, in the wake of the chamber's 52-to-48 vote to put Clarence Thomas on the Supreme Court, the last time issues of gender were so starkly highlighted in a confirmation process.

The Democratic speeches, many delivered to an almost-empty chamber, were part of their strategy of using nearly the full 30 hours of debate time automatically granted to senators, allowing them to delay the final vote on Kavanaugh until late afternoon.

Demonstrators opposed to Supreme Court nominee Brett Kavanaugh are detained by U.S. Capitol police on Saturday.

As they spoke Saturday morning, a mass of predominantly female protesters gathered outside the Supreme Court, chanting "yes means yes, no means no, Kavanaugh has got to go," and "this is what democracy looks like."

Several women detailed their own experiences with sexual assault. In the afternoon, the crowd numbered in the hundreds, with many wearing T-shirts with the words, "November is coming." They marched across the Capitol plaza to the steps, breaking through police barricades. Dozens were arrested, raising their fists as police escorted them away.

But inside, Republicans were lining up in defense of Kavanaugh.

Sen. Dan Sullivan, R-Alaska, who first became friends with Kavanaugh during their shared time in the Bush administration, said he strongly believes those who commit sexual assault should be punished. But he said he also believes in the presumption of innocence.

"We do not want a system of guilty until proven innocent in America," he said.

Sen. Jeff Merkley, D-Ore., delivered a blistering, two-hour speech, starting at 4 a.m., in which he read testimonies from more than 30 rape and sexual assault survivors who had written to him after Kavanaugh's nomination.

"I've received a lot of letters," he said to a silent chamber, almost an hour into his speech. "I'm going to read more of them now."

The sole Republican to oppose Kavanaugh was Sen. Lisa Murkowski of Alaska. But on the floor, she officially withdrew her vote as a courtesy to Sen. Steve Daines, R-Mont., who missed the vote due to his daughter Annie's wedding. The practice, called a "pair between senators," ensures that the vote margin would be the same had Daines been there.

But Trump attacked Murkowski in a brief interview with The Washington Post on Saturday, predicting that she "will never recover" politically for her opposition to his second Supreme Court pick. And the bitter politics over Kavanaugh's confirmation is likely to continue in the coming weeks, months and perhaps years.

"In my view, the biggest losers are the people sitting over there in that court," said Sen. Doug Jones, D-Ala. "This is a partisan Supreme Court . . . and they're the ones that are going to have to try to make it nonpartisan because we can't do it at this point."