Parents of toddlers know the routine: You catch your child red-handed and sticky-fingered—the evidence of a candy raid literally written on his or her face. But instead of a confession, you get a wide-eyed denial: “I didn't do it!”

Learning to tell the truth, even at the risk of punishment, is an important part of moral development, and new evidence suggests it can take seven or more years for kids to get there.

For a study published in 2017 in the Journal of Experimental Child Psychology, University of Michigan developmental psychologist Craig E. Smith and his colleagues recruited 48 children between four and nine years of age. They told the kids a story about a boy or girl doing something wrong, such as taking a classmate's toy or candy, and then either lying about the misdeed to a parent or confessing it. In each case, they asked the children, How would the child feel? How would the mother feel?

The children's answers were generally distributed according to age, which is in line with previous research showing a gradual growth of moral understanding and emotional complexity in early childhood. More of the four- to five-year-olds reported thinking the child in the story would feel better keeping the stolen candy, lying and escaping punishment. They imagined the parent in the study would be angry with the child who confessed. In contrast, the seven- to nine-year-olds were more likely to think the child would feel better owning up to the crime and that the parent would have positive feelings toward a confessor.

Moreover, the results of the storytelling exercise matched real-life behavior. Parents reported that regardless of age, children in the study who associated positive emotions with confessing in the story had a better history of honesty about their own transgressions.

This study dovetails nicely with past research, says developmental psychologist Angela Evans of Brock University in Ontario, whose own work suggests that children's literature can help shape moral development. In 2014 she and her colleagues found that children who were told classic stories about honesty, such as the story of George Washington and the cherry tree, in which he is praised for admitting he cut it down, were more likely to confess to ignoring researcher instructions than the children who heard stories in which bad things happened to kids who lie, as in Pinocchio or “The Boy Who Cried Wolf.”

What parents can learn from these studies, Smith says, is to listen calmly when their child confesses rather than expressing anger. Reward the honesty even if you feel you must punish the offense. Evans adds, “Both these studies support the idea that parents need to show the positive aspects of confession because focusing on the negative consequences of lying does not improve behavior.”