In his book The Dawn Warriors, zoologist Robert Bigelow (1969), gave a stark description of the dialectic between our tribalism and our altruistic cooperation. “A hydrogen bomb is an example of mankind’s enormous capacity for friendly cooperation. Its construction requires an intricate network of human teams, all working with single minded devotion toward a common goal. Let us pause and savor the glow of self-congratulation we deserve for belonging to such an intelligent and sociable species” (p. 3).
Our tribalism has fostered altruism within groups and hostility towards out groups. The most dangerous manifestation of out-group hostility is war.
War as an institution has its origins in the agricultural revolution of the neolithic era, about 10,000 years ago. Prior to this physical conflict certainly existed between hunter gather bands, but these conflicts were limited in scope 
The invention of settled agriculture meant that people now had resources, land and surplus wealth generated by farming that were worth stealing. As farming technology improved, so did wealth. Now societies were able to create better technologies for war and could afford to have military specialists, soldiers, to fight those wars (Eckhardt, 1992).
A society got better at war by having better means of tying individuals to the collective purpose. And societies that were better at war, were more likely to win in battle. We have no better model of group selection than human history.
But precisely because of the historicity of human grouping, we can have some hope for the future. Our tendency to draw a line between in-group and out-group is strong. Freud wrote of the “narcissism of small differences,” and there is no shortage of examples. Tiny leftist sects split and split again over what appears to any outsider as arcane differences of opinion. There is a split between two Hutterite sects over the question of buttons versus hooks for fastening clothes.
However, it is important to note that the line between in-group and out-group is culturally and historically determined.