Before they put on their robes, dozens of federal judges appointed during the Trump and Obama administrations made significant campaign contributions to Senate Judiciary Committee members and their home-state senators — the very people who could make or break their nominations.

And three Republican senators — Ted Cruz and John Cornyn of Texas and Lindsey Graham of South Carolina — got more money than the rest of the Judiciary Committee combined. Virtually all of those contributions came from judicial nominees they ultimately backed.

Home-state senators who haven’t served on the panel also wield considerable influence on who becomes a federal judge. They’ve received significant contributions from donors who ended up on the bench. A Democrat — Bob Casey of Pennsylvania — tops that list.

A CQ Roll Call investigation documented thousands of individual contributions to lawmakers by President Donald Trump and Barack Obama’s judicial appointees in the years leading up to their nominations. Several, both Democrats and Republicans, were major political players before their lifetime appointments. And two Obama nominees appeared to make contributions after they were confirmed despite ethical canons that prohibit such gifts by sitting judges.

Republicans vastly outraised their Democratic colleagues on the Senate Judiciary Committee. Of the six current members who got more than $10,000 from future judges, five were Republicans.