You want a majority to be able to decide who gets punished and who goes free, and even the best designed laws will have unforseen consequences. If the majority is 'evil', well there's just not all that much that can be done in a democracy. Yes it would be better to live in a dictatorship of the most virtuous person in existence, but if you ever figure out how to do that please let me know.