Image copyright US Supreme Court Image caption Brett Kavanaugh, surrounded by his family, was administered the judicial oath by outgoing justice Anthony Kennedy

President Donald Trump's controversial nominee for the Supreme Court, Brett Kavanaugh, has been sworn in following weeks of rancorous debate.

The Senate earlier backed his nomination by 50 votes to 48.

Mr Kavanaugh had been embroiled in a bitter battle to stave off claims of sexual assault, which he denies.

But after an 11th-hour investigation by the FBI into the allegations, enough wavering senators decided to support the nomination.

His confirmation hands Mr Trump a political victory ahead of key mid-term elections in November.

Before the vote, hundreds of people protested against Mr Kavanaugh's nomination at the US Capitol in Washington.

Media playback is unsupported on your device Media caption The moment Vice President Mike Pence announces Brett Kavanaugh's win

During the vote, other protesters shouted "shame" from the public gallery and Vice-President Mike Pence had to call for order to be restored.

Mr Kavanaugh's appointment is for life and he will strengthen conservative control of the nine-judge court, which has the final say on US law.

The 53-year-old was sworn in on Saturday evening in a private ceremony at the Supreme Court. Chief Justice John Roberts administered the constitutional oath, and retired justice Anthony Kennedy - whom Mr Kavanaugh is replacing - administered the judicial oath.

Protesters had gathered outside the court and at one point some ran up the steps and banged on its ornate doors. Other demonstrators climbed on the nearby statue of justice.

Image copyright AFP Image caption Protesters sat on the statue of justice outside the Supreme Court

What has Mr Trump said?

He sent out a tweet of congratulations:

Later he spoke to reporters aboard Air Force One, saying Mr Kavanaugh had withstood a "horrible attack by the Democrats" and that women were "outraged" at what had happened to the nominee.

Mr Trump also said he was "100% certain" that the woman who had accused Mr Kavanaugh of sexual assault, Christine Blasey Ford, had named the wrong person.

So what were the numbers in the Senate?

The upper house is split 51-49 in favour of the Republicans and the vote was largely along party lines. In the end, there was indeed a two-vote margin, the closest nomination vote since 1881.

The only party dissenters were Republican Senator Lisa Murkowski, who had intended to vote no, and Democrat Joe Manchin, who voted yes.

That should have meant a 51-49 tally, but the absence of Republican Steve Daines, a yes voter who was at his daughter's wedding, altered the final figures.

Media playback is unsupported on your device Media caption Donald Trump's nominee has been embroiled in a bitter battle over sexual assault allegations.

Ms Murkowski opted instead to simply mark herself as "present", leaving the final vote 50-48.

What was said in the Senate?

In their final summations, the two Senate party leaders reflected how bitter the divide had become.

Minority Democrat leader Chuck Schumer said Mr Kavanaugh did not belong on the bench as he had "obscured his views to the American people", "repeatedly misled the Senate" and delivered one of the "bitterest and most partisan testimonies ever presented by a nominee".

He also said Mr Trump had "stooped to new depths" in mocking the testimony of Christine Blasey Ford.

Image copyright Reuters Image caption The decision of Susan Collins to vote yes helped sway the final tally

Mr Schumer said that for all those who opposed the nomination, "there is one answer - vote" in the November mid-term elections.

Majority Republican leader Mitch McConnell said Mr Kavanaugh was a "serious scholar, a brilliant student of the law and a meticulous and dedicated public servant".

He said events had "strained our basic principles of fairness and justice" and that the vote showed the Senate was "an institution where evidence and facts matter".

He spoke of "intimidation by the mob" and said the Senate vote should be one "to turn away from darkness".

Ms Murkowski had earlier said that although Mr Kavanaugh was a "good man", he was "not the right person for the court at this time" and his "appearance of impropriety has become unavoidable".

Joe Manchin is facing a difficult re-election campaign in West Virginia, a traditionally Republican state that Mr Trump won by a landslide. He said he "found Judge Kavanaugh to be a qualified jurist".

There were shouts of "shame" from the public gallery as he voted yes.

Two Republican waverers, Susan Collins and Jeff Flake, finally decided to back the judge.

Analysis: Just the beginning

By Anthony Zurcher, BBC North America reporter

Brett Kavanaugh's confirmation to the Supreme Court has been decided. The political war, however, is just beginning.

Donald Trump's court pick generated a controversy that captured the nation's attention in a way that few political issues do. It generated daily headlines rivalled only by the US quadrennial presidential elections.

Now that the bombs have been thrown, it's time to assess the fallout.

Read more from Anthony

Why is the court so important?

Basically, it's the final arbiter of US law.

It has the ultimate say on such contentious issues as abortion and gun control.

The Democrats are still smarting from the previous Supreme Court appointment. Republicans last year successfully stalled the process, meaning it fell to Mr Trump, not Barack Obama, to nominate the new justice. Mr Trump's choice of Neil Gorsuch strengthened the conservative leaning.

All eyes will now be on November's mid-term elections. Mr Trump will be able to campaign on the back of an important victory, but commentators will be watching closely how the Kavanaugh affair affects women voters.