President Donald Trump nominated Brett Kavanaugh to serve on the Supreme Court.

The Senate, tasked with the confirmation process, has 51 Republicans and 49 Democrats, and needed a simple majority to confirm him.

While Kavanaugh's confirmation seemed all but certain when Trump nominated him, three women publicly accusing him of sexual misconduct threw his nomination process into chaos.

The Senate ultimately confirmed him to the high court on October 6, by a vote of 50-48. Here's how the vote broke down.

When President Donald Trump nominated Brett Kavanaugh, a federal appeals judge, to fill the vacancy on the Supreme Court left by the retirement of Justice Anthony Kennedy in July, it immediately created a horse race for Senate Republicans to lock down at least 50 votes in his favor. And Senate Democrats rushed to block the nominee.

Because of the split nature of the Senate, in which Republicans control 51 seats and Democrats have 49 (including two independents who caucus with Democrats), the confirmation process was always going to come down to the wire. Republicans needed a minimum of 50 votes to confirm Kavanaugh. In that scenario, Vice President Mike Pence would have to cast the tiebreaking vote.

Most senators were reliable to toe the party line in voting for Kavanaugh. But the vote count was expected to be closer than ever because of two moderate Republican senators — Lisa Murkowski of Alaska and Susan Collins of Maine — and a handful of Democrats facing tough reelection bids this November in traditionally red states.

The Senate Judiciary Committee's series confirmation hearing for Kavanaugh began on September 4, when political infighting enveloped much of the panel. But the committee's chairman, Sen. Chuck Grassley of Iowa, vowed to continue moving forward with the process.

And then on September 16, Christine Blasey Ford came forward accusing him of sexually assaulting her when they were teenagers in the early 1980s, throwing his nomination into even more chaos. Two other women came forward with allegations, as well, which Kavanaugh denied.

On September 27, the Judiciary Committee heard hours of testimony from Kavanaugh and Ford. She detailed her allegations, and he denied them all.

After an FBI investigation, and significant mud-slinging between Democrats and Republicans, it was finally time for the final vote.

But Republican Sen. Steve Daines was back in his home state of Montana for his daughter's wedding, so he couldn't cast his vote. Because Daines did not vote, Alaska Sen. Lisa Murkowski, the only Republican who opposed Kavanaugh, withdrew her vote in a rare display of "vote pairing," a sign of respect when senators cannot attend certain votes.

The Senate confirmed Kavanaugh on Saturday, October 6 by a simple majority of 50-48. Here's how the vote broke down:

Read Business Insider's full coverage of the Ford-Kavanaugh hearing and his confirmation: