That said, people are also naturally predisposed to help others, even strangers. People are born with a natural sense of reciprocity: if someone helps you out, you usually feel obligated to help them back in a virtuous cycle of tit-for-tat (‘this-for that’). A gene that codes for helping others can thrive--as long as it helps others who are likely to repay kindness with kindness. It also pays in an evolutionary sense to help relatives who share genes, much as it pays to help people who are part of our social safety net in a time of their need, with the knowledge that they won’t leave us in our time of need. We need true friends, not fake friends.
It’s pretty clear to me how this leads directly to racism as a form of kin discrimination, and to bigotry in general. There’s a good chance that someone who looks like you shares genes with you. In a world of brutal competition—that is, the world in the ‘state of nature’ described by the great political theorist Thomas Hobbes—paranoia and distrust of others who look or act differently boils down to hurting competitors in the evolutionarily zero-sum world of leaving offspring that contribute to future generations. It’s an ugly picture of an ugly world. In this view, ideologies and morality are tools for social cohesion and survival. Ideologies often give disproportionate benefits to their greatest champions, and serve to generate rules for whom to trust and help, and whom to hurt or ignore. There’s a pretty good reason why religions such as Christianity and Islam -- which are built on ideals such as mercy, charity, and compassion -- nevertheless can lead people to destroy each other over differences in doctrine. Protestant versus Catholic. Sunni versus Shi’a. You name it, the ultimately tribal affiliations that allow people to be kind to those in their in-group also lead people to discriminate against those in out-groups.