When was the last time you were tempted, even briefly, to do something a little immoral? To lie, betray a friend’s confidence, cut in line, or take a little more than your share? I’m willing to bet it was today. Maybe in the past hour. Larger temptations hound us too, especially those involving sex or money. And yet, perhaps to a shocking extent, we often rise above these temptations and act morally nonetheless. But how does the inner struggle with temptation affect how our actions are viewed by others? Who is the better person: the one who acts morally while tempted or the one who is never tempted at all?

There are two strands of moral philosophy that, loosely speaking, make opposite predictions about which kinds of actions will be seen as most moral. One argument, associated with Aristotle, is that a truly moral person will wholeheartedly want to do the right thing, and no part of her will be tempted to act immorally. Another argument, associated with Immanuel Kant, is that an action is truly moral only if it is not something you want to do – otherwise, a person is just acting on her own desires, and although the result might be positive, it should not be considered especially moral. These philosophers are arguing about which actions we should see as most moral. But which of these views best captures how ordinary people actually do reason about morality?

To answer the question and uncover how people reason about overcoming temptation across a lifespan, my team recruited more than 250 children, aged three to eight years, and nearly 400 adults. Each participant was asked to consider several child-friendly scenarios depicting two characters who both acted morally. One story, for example, described two children who had each broken something of their mother’s. Both ultimately told their mother the truth about what they had done. And both children wanted to tell the truth, and wanted to do the right thing. But one child was also tempted to lie to avoid punishment, yet told the truth even though she found it difficult. The other child found it easy to tell the truth, and wasn’t tempted to lie, because she wasn’t concerned about the punishment. We then asked which of the two truth-tellers was more morally praiseworthy.

We found a striking developmental difference: three- to eight-year-old children judged that someone who does the right thing without experiencing immoral desires is morally superior to someone who does the right thing through overcoming conflicting desires – but adults had the opposite intuition. And these judgements showed up across a number of different immoral temptations, including lying, not helping a sibling, and breaking a promise. They appeared whether we asked about which character should be rewarded for her actions, which character was ‘more good’, or which character was most likely to act morally in the future.

That adults favoured the conflicted character was somewhat surprising, because plenty of previous research has found that adults judge negative intentions and desires to be morally blameworthy. Yet here we have identified situations in which adults award more moral credit to people who have some negative desires, rather than only positive desires. This may be because, like Kant, adults see the desire to act immorally as an essential component of what makes a truly moral act instead of an enjoyable action that happens to have a positive result. In this view, it’s only when we want to be bad that we have the ability to choose good.

Of course, there are other kinds of immoral temptations that adults might judge just as harshly as children. For example, a person who is tempted to molest a child but overcomes that temptation is unlikely to be seen as more moral than someone who was never tempted to molest a child in the first place. Uncovering the characteristics of temptations that lead to moral praise and those that lead to condemnation is something we are looking more closely at in continuing studies.

Meanwhile, our findings to date suggest that children start out with an Aristotelian moral psychology, judging individuals who don’t struggle with moral decisions as more moral than those who do. But sometime after age eight, they transition to a more Kantian framework, judging the worth of moral actions according to how difficult the actions were for the actors.

So what changes as we age?

One possibility is that children lack firsthand experience with inner conflict. At first blush, this seems odd – children certainly misbehave frequently, and so it might seem like they must be experiencing the temptation to act immorally all the time. But it might be that kids don’t often simultaneously experience both the desire to be bad and the desire to be good, and that gaining experience with this kind of personal inner struggle as they grow older helps them to value it, or at least not to condemn it, in others. A related factor might be a growing appreciation of willpower itself.

Finally, and intriguingly, it might be that children inherently prefer people with a unified self. As we grow older, though, we come to appreciate the nuances of a more complex character that allows for both temptation and the willpower to overcome it.

So the next time you find yourself guiltily experiencing immoral temptations, relax. It might even earn you some extra praise from your adult friends, so long as you do the right thing in the end. Your children, on the other hand, will be judging you quite harshly!