This shouldn't surprise anyone. It's basic psychology that should be taught in school.
https://en.wikipedia.org/wiki/In-group_favoritism
Edit: And it's something to keep in mind with politics. The other side is not nearly as evil or stupid as you think they are, nor is your side as righteous or clever.
Edit 2: It also fuels racism and xenophobia.
Edit 3: Which reminds me, PG's essay on identity: http://www.paulgraham.com/identity.html