Just World Hypothesis
[Psychologist Melvin] Lerner hypothesized that the belief in a just world is crucially important for people to maintain for their own well-being. However, people are confronted daily with evidence that the world is not just: people suffer without apparent cause. Lerner explained that people use strategies to eliminate threats to their belief in a just world. These strategies can be rational or irrational. Rational strategies include accepting the reality of injustice, trying to prevent injustice or provide restitution, and accepting one’s own limitations. Non-rational strategies include denial or withdrawal, and reinterpretation of the event.
There are a few modes of reinterpretation that could make an event fit the belief in a just world. One can reinterpret the outcome, the cause, and/or the character of the victim. In the case of observing the injustice of the suffering of innocent others, one major way to rearrange the cognition of an event is to interpret the victim of suffering as deserving of that suffering.
— Wikipedia, Just World Hypothesis
It explains so much.