I investigate how political incentives affect the behavior of district attorneys (DAs). I compile a new comprehensive dataset on the election cycles and offices sought for all district attorneys in office during the steepest rise in incarceration in U.S. history (roughly 1986–2006). Exploiting variation in the timing of elections, I find that being in a DA election year increases per capita admissions and months sentenced to state prisons. I estimate that the election year effects on admissions are akin to moving 0.85 standard deviations along the distribution of DA behavior within state (e.g., going from the 50th to 80th percentile in the intensity of sentencing activity). I also find evidence that sentencing outcomes are associated with public sentiment: (1) election effects are higher in Republican counties; (2) election effects depend on county political ideology more than DA ideology, with effects larger in contested elections; (3) anti-Black/pro-White county-level bias is associated with greater punitiveness on Black prisoners throughout the entire election cycle; (4) election effects declined in the era of rising incarceration, closely coinciding with softening public opinion on punishment; and (5) election effects disappeared at the national level after the era of rising incarceration ended. Taken together, these findings suggest DA behavior and sentencing outcomes may respond to voter preferences—including to racial sentiment and preferences regarding the harshness of the court system. This paper thus highlights how collective approaches to transforming U.S. public opinion, and not simply technocratic approaches to policy, may be instrumental in curbing mass incarceration.