This book, The Lucifer Effect, contains a thorough analysis of how systems and situations can make decent people perform evil actions. It also has some ideas as to how we can learn to resist situational, social and systemic pressures and do the right thing in spite of huge levels of personal discomfort. This work can also be found at the Lucifer Effect website at Resisting Influence.
A paragraph from page 456 of the book will give some idea of his approach and style:
I would like to add two final general recommendations. First, be discouraged from venal sins and small transgressions, such as cheating, lying, gossiping, spreading rumours, lauging at racist or sexist jokes, teasing, and bullying. They can become stepping stones to more serious falls from grace. They serve as mini-facilitators for thinking and acting destructively against your fellow creatures. Second, moderate your in-group biases. That means accepting that your group is special but at the same time respecting the diversity that other groups offer. Fully appreciate the wonder of human variety and its variability. Assuming such a perspective will help to reduce group biases that lead to denigrating others, to prejudice and stereotyping, and to the evils of dehumanisation.