Senate Majority Leader Mitch McConnell was upbeat the night after Justice Anthony Kennedy announced he was retiring from the Supreme Court. The Kentucky Republican had already led the Senate in confirming more circuit court judges in the first year of Donald Trump's presidency than in that of any other president in history. Now McConnell has the chance to confirm a second Supreme Court justice, a thrilling prospect for his party.

More than any other accomplishment, including the passage of the GOP's tax cuts, the remaking of the judiciary is fast becoming the cornerstone of the Republican leader's legacy. It's something he's been working on for a long time.

"Well, I think it's a little too early to be talking about legacy," McConnell said with a smile as he left the Senate chamber.

Get Breaking News Delivered to Your Inbox

"A year and a half ago, I said it was a top priority," he said about confirming judges, "and it remains so."

With McConnell leading the way in the Republican-controlled Senate, Trump is seeking to put his imprint on the federal judiciary for generations to come. While the latest opening on the Supreme Court is commanding all the attention, the nominees to the lower courts are also consequential. More than 40 federal district and circuit court judges have been confirmed to lifetime appointments so far during Trump's term, and those judges will have enormous sway in shaping legal arguments nationwide.

Nearly 100 other judicial nominees are awaiting Senate confirmation. In all, there are more than 150 vacancies on the courts.

The GOP's focus on the judiciary has been sharpened by their narrow 51-49 Senate majority, which has made passing legislation difficult. Sixty votes are normally required to advance a bill, while judges can be confirmed with a simple majority.

The newcomers to the bench follow a type. An Associated Press analysis found that roughly two-thirds of the judges who have been confirmed under Trump are white men. Of the 42 confirmed nominees, including Supreme Court Justice Neil Gorsuch, none are black. Ten are women, nine of them white. Three of the judges are Asian-American men and one is a Hispanic man.

In contrast, during President Barack Obama's two terms, only 37 percent of judges confirmed were white men. Nearly 42 percent were women — the highest share of female judicial appointments of any president.

"What the administration is seeking is to transform the face of the entire federal judiciary," said Nan Aron, president of Alliance for Justice, a liberal group that tracks court issues.

"The nominees share one basic characteristic — their hostility to progress that's been made in women, workers and civil rights as well as health and safety over the past several decades," she said. "This probably is the most extremist slate of judges we've ever seen."

Conservative judicial advocates say the judicial appointments are correcting the leftward tilt of the bench. They see Trump and McConnell's revamping of the courts — in the face of Democratic filibusters that stall even popular nominees — as more important than even legislative victories.

Carrie Severino, the chief counsel and policy director at the conservative Judicial Crisis Network, says, "It's something that's viewed across the Republican and libertarian base as a huge accomplishment."

Republicans have often been seen as taking greater interest in the judiciary than Democrats. McConnell works closely with the Federalist Society, which is at the forefront of conservative judicial thinking, and he helped the group draft Trump's list of 25 potential Supreme Court nominees. He well understands the power of the judicial branch to shape policy and mobilize voters.

McConnell laid the groundwork for this moment with a startling move just hours after Justice Antonin Scalia's unexpected death in February 2016. He announced the Senate wouldn't consider Obama's nominee because it was a presidential election year. He followed through on that vow, holding the seat open until after Trump took office. Democrats remain livid over the move to this day, calling it a stolen seat.

But the Republican blockade helped solidify conservative and evangelical support for Trump during the election, as many rallied to the cause of having a Republican president fill the seat. McConnell has characterized the gambit as his single greatest achievement.

Douglas Johnson, the senior policy director for National Right to Life, says the federal judges being confirmed are "extraordinarily qualified." He praised McConnell for recognizing "this is important."

"We saw Sen. McConnell's extraordinary leadership at the time of Scalia's death — this is a continuation of that," he said.

Those familiar with McConnell's thinking on the judiciary saw him beginning to play the long game — the title of his autobiography — years earlier.

It began when Democrat Harry Reid of Nevada, then the Senate majority leader, changed the rules of the Senate. Frustrated with GOP roadblocks in the Obama era, the Democrats eliminated the filibuster for nominees for the administration and judiciary, other than for the Supreme Court. In practice, that means that 51 votes, rather than 60, are needed to confirm nominees.

Reid's move was so inflammatory — it is known as the nuclear option — that it came with a warning from McConnell on the Senate floor: "I say to my friends on the other side of the aisle, you will regret this, and you may regret it a lot sooner than you think."

After Republicans won control of the Senate in 2014, McConnell became leader — and the confirmation of Obama's nominees started grinding to halt. As Trump was about to take office, there was what some call an emerging vacancy crisis, with some 100 openings in the judiciary.

Scott Jennings, a former George W. Bush administration official and longtime McConnell strategist, said the Senate leader saw in the judicial openings the opportunity to "restore some balance."

Jennings said, "It became clear to him that one of the things he could do is set up the next president to remake the judiciary."

In early 2017, when Gorsuch's nomination was headed toward a Democratic-led filibuster — which McConnell's office notes would have been the first ever of a Supreme Court nominee — the Republicans changed the rules again to allow the confirmation of justices with 51 votes.

"I think it's paid off," Jennings said. "Laws can be changed, regulations can be wiped away, but these federal judicial appointments are lifetime."

He added, "For 30 years we'll be talking about the Trump-McConnell courts and their impact."