IN 2013 Charles Hynes, Brooklyn’s district attorney, was voted out of office after 24 years on the job. The ousting of an elected local prosecutor is rare in America. Incumbents who run for re-election win 95% of the time. Until Mr Hynes got the boot, no incumbent DA had lost a vote in Brooklyn since 1911. Mr Hynes’s fate needs to be more common, however, if America is to cease to be the world’s leading jailer. At present, it accounts for 5% of the world’s population and nearly 25% of its prisoners. Elected public prosecutors, such as Brooklyn’s Mr Hynes, are largely to blame.

The incarceration rate is like the water level in a bathtub. If the tap runs faster than the water drains, the level rises. The mandatory minimum sentences and truth-in-sentencing laws passed in the 1980s and 1990s blocked the outflow from America’s prison system. Proposals for sentencing reform, such as the bipartisan bill introduced by Chuck Grassley, a Republican senator from Iowa who chairs the Senate Judiciary Committee, would clear it a bit, by returning some discretion to judges and parole boards. But it would be even better to turn down the gushing tap.

Although the crime rate began to decline in the 1990s, the rate of admissions to prisons continued to climb for two decades, until it peaked in 2006. The criminal-justice system managed to put more and more people behind bars for 15 years, even though fewer and fewer people were committing crimes. The admissions rate has now reverted to the level in the late-1990s, but remains three times greater than it was 30 years ago when the crime rate was higher than it is today.

In a study published in 2013, “Why are so many Americans in prison?”, Steven Raphael at Berkeley and Michael Stoll at UCLA found the answer was mostly that prosecutors liked to send them there. Longer sentences, they say, played a smaller role. John Pfaff, a law professor at Fordham University, confirmed the finding: analysing the available data on how prosecutors behave, he found that the probability of a DA filing felony charges against an arrested person rose from about one in three in 1994 to about two in three by 2008.

DAs can decide whether charges will be filed against arrested persons and, if so, what they will be charged with. Less than 5% of criminal cases go to trial: most end in plea bargains. And it is DAs who decide which plea deals to offer and accept, in effect determining whether offenders will be sent to prison and, if so, for how long. By and large, they are not a merciful lot.

They are also usually elected at county level, whereas prisons are run at state level. Short sentences—less than a year in most jurisdictions—are often served in county jails, putting county taxpayers on the hook. Punitive DAs can take the fiscal burden off the people who elect them by foisting the cost of imprisonment onto states.

If legislators cannot rein in DAs, that job must fall to voters. Because unseating an incumbent is so unusual, and because there are more than 3,000 county and state district attorneys, this may seem an unpromising path to a lower incarceration rate. But more than half of state prisoners, who make up the vast majority of the incarcerated, are housed in just ten states. Within those states, most prisoners come from a few large metropolitan jurisdictions. Moreover, these areas tend to contain lots of rehabilitation-minded liberals as well as minority voters, who are more likely to have family members in prison. Prosecutors in California and New York have already changed tack, and incarceration rates in those states have fallen.

Kenneth Thompson, Brooklyn’s first black DA, managed to knock Mr Hynes off his perch by highlighting a couple of dodgy murder convictions and speaking out against aggressive police tactics. And though sentencing reform is obviously needed too, the election of just a handful of “smart-on-crime” DAs in and around big cities like Houston, Chicago, Miami and Los Angeles could cut America’s incarceration rate even more dramatically.