Whenever an individual is faced with certain thoughts, feelings and emotions that are conflicting with societal norms it generates a lot of anxiety, stress or guilt in the system. Since all of this is against moral values, our mind then generates a subtler and safer way to execute these feelings.
This different way of channelizing the same thoughts, feelings, emotions are done in a very socially acceptable manner. Thus, it reduces the stress/anxiety/guilt. All of this happens at an unconscious level so the person is not aware of it.