President Donald Trump is finding his agenda stalled almost everywhere. Trumpcare is facing an intense political backlash and uphill battle to clear Congress. As of Tuesday afternoon, 26 Republican House members were opposed to the American Health Care Act, meaning the bill won’t pass unless at least six of them change their minds; the Senate will be equally challenging. Trump’s executive orders on immigration have been repeatedly blocked by the courts. Other promises, like infrastructure spending and renegotiated trade agreements, have been put on the back burner. Trump’s push for an “America first” foreign policy has been undermined by the ongoing investigation into Russian interference in last year’s election, which has cost the president his national security advisor and raised suspicion about his friendly overtures toward Russia.

In general, Trump’s manifest managerial incompetence is impairing his ability to actually do anything. Even the conservative Wall Street Journal, which has kept an open mind about Trump, notes that the president is little trusted. “If President Trump announces that North Korea launched a missile that landed within 100 miles of Hawaii, would most Americans believe him? Would the rest of the world?” the Journal editorialized on Monday.  “We’re not sure, which speaks to the damage that Mr. Trump is doing to his Presidency with his seemingly endless stream of exaggerations, evidence-free accusations, implausible denials and other falsehoods.”

While most of the Trump agenda is sandbagged by a combination of internal (incompetence) and external (opposition) factors, his Supreme Court nominee Neil Gorsuch, who faces his third day of Senate hearings on Wednesday, is almost certain to ascend to the seat held by the late Justice Antonin Scalia. The worst-case scenario for Trump is that Democrats delay and filibuster, forcing the Republican majority to use the “nuclear option”—so that Gorsuch’s confirmation would only require a 51-vote majority in the Senate, as opposed to 60. Barring some unforeseen revelations about Gorsuch’s past that turns Republicans against him, he’s a shoe-in. And Trump, if he follows the path he’s taken with the Gorsuch nomination (picking a justice acceptable to conservative Republicans) might have other Supreme Court nominees in the coming years. As for the lower courts, “Trump could soon find himself responsible for appointing a greater share of federal court judges than any first-term president in 40 years,” according to The New York Times.

The courts are the one area where Trump will undoubtedly leave his mark on American politics. This is not an accident. His chaotic management style might be wrecking havoc on the day-to-day operations of the White House, and he might lack the skills necessary to be a stable (let alone successful) executive, but there is one thing he is good at: bilateral deal-making. That’s a skill set that turns out to be much more useful for the politics of filling the courts than it is to issues like health care (where the need for multilateral negotiations seem to flummox the president), let alone the complexity of international diplomacy.

The Supreme Court has been central to Trump’s political success. After the sudden and unexpected death of Scalia last year, Trump successfully used the court vacancy as leverage to consolidate support from Republicans who might otherwise be suspicious of him. (Trump was, of course, helped tremendously by Mitch McConnell, who led Republicans in blocking Merrick Garland, President Barack Obama’s nominee.) Trump circulated lists of the potential judges he’d nominate, with an emphasis on the fact that they’d be strict originalists in the mode of Scalia. This was a major factor in winning over doubters like Ted Cruz  and the evangelical community, which supported Trump more than any Republican presidential nominee since George W. Bush. “He made it very clear who his Supreme Court picks would be if he was elected,” Jerry Falwell, Jr., the president of Liberty University, said last December. “I think that was a big factor [behind evangelical support].” Trump’s pick of Gorsuch is rightly seen as a fulfillment of his promise to evangelicals and movement conservatives. 

Court nominations are a rare aspect of government where Trump’s preferred method of bilateral deal-making can actually work. That’s because the politics of the courts involves a simple binary choice (a liberal justice or a conservative one) that will satisfy or displease Republican voters. The binary nature of the decision makes it easy for Trump to make a promise and then keep it. What Trump is finding with issues like health care is they involve much more complex negotiations rooted in a grasp on policy that he doesn’t possess. In areas like foreign policy, Trump has to grapple with an often recalcitrant bureaucracy that is willing to push back against his unorthodox policies.

The success Trump has achieved with his nomination of Gorsuch even suggests a way for him to take control of the political agenda again. If Trump really wanted to gamble, he might try to use his nomination power in the courts as leverage over the Republican Party on issues where he’s meeting resistance, like health care or a Russia reset. He could tell Republicans in Congress that they have to follow his line or he’ll slow down his nominations to the federal courts and possibly nominate a moderate justice for the next Supreme Court opening. Such a move would risk alienating his Republican supporters, but it would also give a potent weapon to force the Republicans on Capitol Hill to stay in line. Whether he decides to take the risk or not, the prerogative to nominate judges is likely to remain Trump’s main source of political power.