In psychology, there's a theory by Lawrence Kohlberg that explains how people develop their sense of right and wrong.
Kohlberg suggested that we grow through three main levels, six stages in total. As we mature, we’re supposed to go from doing what’s right out of fear, to doing what’s right out of love for justice and deep personal conviction.