A good example are prosecutors and defense attorneys.
I've met many prosecutors who believe it's okay to put away people for many years even if they personally have doubts about their guilt.
I've met many defense attorneys who believe it's okay to get people acquitted, when they've confessed their guilt to the attorney.
This isn't because they are amoral people at their core, it's because they have a job, and want to be able to sleep at night while still doing that job, so they convince themselves.