ScienceDaily: Why We May Feel Guilty
On one hand, the punitive feeling of guilt may keep you from repeating the same transgressive behavior in the future, which psychologists call "withdrawal motivation." Conversely, some researchers view the function of guilt in a societal context, in that; it keeps people's behavior in line with the moral standards of their community. This view emphasizes a more positive emotional experience and is associated with "approach motivation."
