Altruistic behaviors, such as going to war for your village or nation represent an evolutionary conundrum. If one gene resulted in the expression of altruism and that gene was present in all the members of the social group, the group as a whole would prosper from this selflessness.
For instance, a tribe of altruistic warriors will be more fearless and effective in battle, which, in turn, increases the dominance and growth of their clan. However, any individual lacking the gene will benefit from the altruism of the group without partaking in any of the cost of these behaviors, such as dying in battle.
These “defectors” without the altruism gene would reproduce more and eventually bring the whole edifice of altruism tumbling down.
The argument goes that warfare kept this problem in check. Groups with a high proportion of free-loaders might, from time to time, be wiped out by groups that benefited from having the full complement of altruists in their midst.”
– by Dean Buonomano, Brain Bugs: How the Brain’s Flaws Shape Our Lives