Also known as "us and them" thinking.
Out of all the irrational beliefs people hold, this is arguably the single most dangerous one.
It violates the principle of individual integrity and it is prejudice incarnated. It is also a clever way of escaping personal responsibility and the burden of owning up to all your choices, all the time, in their full and whole consequence, at all levels. There are two main groups of people who are attracted to group identities. The first and by far the largest group consists of stupid and weak people who seek "membeship" out of fear. The second one is made up from the evil, manipulative power-seekers, who see their opportunity for personal gain in assuming leadership over the weak and stupid ones.
Individual thinkers of integrity and character will intuitively seek to avoid group identities.
I am personally of the opinion that this is where human evolution stops. Unless we are able to somehow eradicate the very common tendency to think of ourselves and others in terms of tribal categories, genders, races, nationalities, sexual preferences, faith based affiliations, etc., we are not going anywhere; any of us. Unless we are able to really really fathom that we are all individuals, but at the same time we are all the same, this is as good as it gets. That is to say, this world as it is right now, with all its war and pestilence, exploitation and misery.
"The idea of God is the sole wrong for which I cannot forgive mankind." (Alphonse Donatien De Sade)