WASHINGTON — President Donald Trump failed repeatedly to get Congress to pass a new health care law. He came up empty on immigration and gun bills after giving lawmakers conflicting messages. His budgets were ignored on Capitol Hill. And after 17 months in office, he has yet to even write his long-promised measure to repair the nation’s infrastructure.

Yet when it comes to stocking the nation’s federal courts, Trump has performed with remarkable efficiency and success. He got the Senate to confirm conservative judge Neil Gorsuch for the Supreme Court soon after taking office and since has been remaking the lower courts far more quickly than his predecessors.

His secret: outsourcing.

Unlike in other areas in which Trump insists on calling the shots, the president has deferred to a trio of more experienced hands when it comes to the judicial nominations so important to his conservative base.

“This is a zone where Trump is willing to say, ‘I got a guy here who knows what he’s doing,’?” said Newt Gingrich, the former House speaker and informal Trump adviser.

Gingrich was talking about Donald McGahn, the White House counsel who has held a tight grip on the interview process. Yet Gingrich and others give singular credit to Leonard Leo, the executive vice president of the Federalist Society, a national network of conservative lawyers; Leo, starting at Trump’s request during the 2016 campaign, worked along with the Heritage Foundation to create the unprecedented list of Supreme Court candidates that Trump has used to select Gorsuch and his soon-to-be-announced pick.

The third player is Senate Majority Leader Mitch McConnell, R-Ky., who for nearly a year blocked President Barack Obama’s final Supreme Court pick, Merrick Garland, leaving the vacancy for Trump to fill with Gorsuch. Since then McConnell has engineered smooth confirmations in the narrowly Republican-controlled Senate for Gorsuch and dozens of lower-court nominees, almost all of whom have been vetted by Leo. McConnell calls his role in the judiciary’s makeover his proudest legacy.

Lesser known than the other two men, Leo has spent decades working toward a judiciary that shares his anti-abortion rights views and conservative positions on interpreting the Constitution narrowly. As he did during the Gorsuch confirmation process, Leo has taken a leave from the Federalist Society to advise Trump. This week he created a war room to spearhead the selection and confirmation process.

The list Leo began preparing during the campaign now includes 25 people, all but one of them judges with long records on the issues conservatives most care about. Candidate Trump released it to assure conservative voters who were wary of him, thrice-married and former Democrat who had an inconsistent record on abortion, gun control and other litmus-test issues.

Trump has said that Monday he will name a replacement for Justice Anthony Kennedy, who announced last week he would soon retire. Among the potential nominees is Sen. Mike Lee, a Republican from Utah who spoke by phone with Trump on Monday, according to a White House statement released Tuesday.

White House spokesman Raj Shah said Trump on Tuesday spoke to three other candidates, whom Shah did not name. The president interviewed four appeals court judges at the White House on Monday, according to several reports: Amy Coney Barrett of the Seventh Circuit; Brett Kavanaugh of the D.C. Circuit; and Raymond Kethledge and Amul Thapar of the Sixth Circuit.

Douglas W. Kmiec, who vetted judicial nominees in the Reagan administration, said Ronald Reagan would never have allowed the Federalist Society to vet his nominees, thinking it “a betrayal of the presidential process.”

“As a political gambit, it’s unassailable,” Kmiec said of Trump’s list, noting that it helped Trump gain political backing from evangelical voters and other conservative skeptics during the campaign.

But what’s objectionable, he said, is “just the precedent of a president giving up this authority en masse.”

noah.bierman@latimes.com