March to (the beat of) a different drummer

To believe in a different set of principles than most other people.

My friend marches to the beat of a different drummer although he does what he thinks is the right thing to do.