There in Canada, prosecutors are not elected, because that would be completely batshit insane.
The prosecutor's job is to represent the State by applying the law to the facts. The public doesn't pay attention to the details of every individual case. The Public looks for narratives like "tough on crime," or "protecting the children," or "cracking down on illegals" or "protecting minorities," depending on where voters fall on the political spectrum.
Elected politicians put their voters’ demands first, but prosecutors are supposed to put the law and department policy first. Prosecutors would be tempted to prosecute based on political will - not guilt and evidence - which is unjust by definition. And since they're elected, they don't have to answer to the AG or city council - just the polls.
It's better to elect reps that hire/confirm, supervise and set policy for prosecutors instead.
In states that don't elect judges, they are appointed. Who makes a decision on who is appointed? The politicians of course. And you’re never going to get appointed unless someone owes you it.
Here, the justice system is completely unaccountable to the public, and if persecutors would be elected (in open elections), they would win by not jailing innocents.
[1] https://en.wikipedia.org/wiki/Sheriffs_in_the_United_States#...
[2] https://digitalcommons.law.yale.edu/cgi/viewcontent.cgi?arti...
[3] https://www.nytimes.com/2008/05/25/world/americas/25iht-judg...
Would you prefer that voting went back to just the white educated land owners? Does that sound any more "just"?
Among others, the fine people of Dallas County, Iowa, where this drama is taking place.