This perplexing question has tortured humanity from ancient times, specially in the story of Abraham who rejected the mass murder of an entire city [Sodom]. He asked how it was just to kill off the innocent along with the guilty. The surprising result was that he was blessed for this genuine rejection - yet the entire city of Sodom was destroyed.
Seen as a metaphoric story, it does allign with deaths of innocent people everywhere we look - in plane crashes and tsunamies, thereby there is no merit in leaving this to chance - because the universe works on majestic laws of engineering, physics and math, and is not functioning randomly.
One answer is that the universe is made up of a positive/negative duality - and critical mass applies. Where the negative is critically greater than the positive - the neutral entities go with the negative. This also works the reverse mode - a bad person can be saved. When we contemplate this, it appears correct, even when it makes the personal rights of one disregarded - because a community's rights overides an individual - this is also the premise in a Judiciary system. But this does not mean there is no sense of justice - only that the justice occurs in a mode not seen at the time, but eventually does occur in a mode which does not parallel our small thoughts.