Primatological and archeological evidence along with anthropological accounts of hunter-gatherer societies indicate that lethal between-group violence may have been sufficiently frequent during our ancestral past to have shaped our evolved behavioral repertoire. Two simulations explore the possibility that heroism (risking one's life fighting for the group) evolved as a specialized form of altruism in response to war. We show that war selects strongly for heroism but only weakly for a domain-general altruistic propensity that promotes both heroism and other privately costly, group-benefiting behaviors. A complementary analytical model shows that domain-specific heroism should evolve more readily when groups are small and mortality in defeated groups is high, features that are plausibly characteristic of our collective ancestral past.