A compassionate disposition and a desire to see someone get their “just deserts” might not seem to go together. But a new study suggests that people who are more compassionate also prefer to see harsher punishments doled out when someone perpetrates an injustice against others.

As part of the study, published in Journal of Personality and Social Psychology, researchers in Denmark asked people to consider a variety of situations in which others experienced unjust suffering. These ranged from terrorist attacks to sexual assault to war.

They found that people who had more compassion for victims who suffered because of these events also tended to endorse stronger punishments for those who perpetrated the events.

Further experiments revealed that people who had more compassion for victims experienced greater moral outrage, which in turn was associated with an inclination for harsher punishments. This link between compassion and punishment was present when people suffered because of events involving a high level of injustice, but not when the events involved a low level of injustice.

This study draws on what psychology researchers have called, appropriately, the “just deserts” theory of punishment. The basic idea here is that even though people often say the main goal of punishment is deterrence, on a more basic level they might really just feel that the person who perpetrated some action deserves to be punished.

Indeed, one study showed that most people pay more attention to factors like how large of a moral violation an offense was than how often a perpetrator has committed the offense or other factors that are more closely linked with deterring future offenses.

This belief that one of punishment’s important roles is to get some kind of “payback” on behalf of people who were wronged might help explain the link between punishment and compassion. According to the authors of the study, their findings ultimately show that even compassion can have a dark side, and that psychology research needs to consider, paradoxically, “the harmful consequences of compassion.”