On Aug. 5, when a gunman drove to a Sikh temple outside Milwaukee and started shooting his 9-mm handgun, some ran and some leapt to stop him. One of the six who died was temple president Santwat Singh Kaleka, who has been hailed as a hero by witnesses who say he tried to disarm the shooter. The first cop on the scene, Brian Murphy, took nine bullets as he also tried to help. Miraculously, Murphy wasn’t killed.

Why do some people confront danger while most scamper for the exits? Altruism emerges in many disasters. A few weeks ago, three women came forward to say they survived the cinema shooting in Aurora, Colo., because their boyfriends shielded them. All three men are dead. In January, when the colossal cruiser Costa Concordia foundered on the western coast of Italy, a 57-year-old crewmember stayed aboard and helped others even as his captain — and thousands of passengers — abandoned ship. Thirty-two people died.

The difficult thing about studying those who are altruistic during calamities is that most of them die. Also, we like to create heroes. As researchers Selwyn Becker and Alice Eagly pointed out in the journal American Psychologist in 2004, the idea of heroism exists in virtually every human culture ever recorded — from cave paintings and folklore to the dawn of literature and right up to, say, The Dark Knight Rises.

Because heroism is so deeply valued, Becker and Eagly define it as not only noble risk taking but also something selfish, a way to ensure status. Earlier this year, the journal Evolutionary Psychologypublished a study by two psychologists who found that participants who willing to endure pain — having to put their hands into a tub of ice for 40 sec., or being dunked into a tank of water — were not only judged to be more likable but also given significantly more money from an $1,170 pot that could be divvied up any way the other student volunteers wanted.

The study was small — 78 participants — and none were threatened with death. But the authors concluded that “engaging in ‘self-sacrificial behavior’ is a profitable long-term strategy.” In short, heroic and egotistical impulses can arrive at the same moment. But can we choose between them?

The U.S. Department of Defense has funded studies at Yale designed to examine the difference between service members who are steely during and after combat and those who break. Psychiatrist Deane Aikins, who supervises some of those studies, discourages the idea that heroism is a choice. “The hard part for many people to understand is that the man even being alive is a miracle,” he says, referring to Murphy, the cop in Wisconsin. “It may be that some people have stress hormones that run cooler in dangerous situations.” But after studying hundreds of veterans who served in Afghanistan and Iraq, Aikins believes that most tried to run but couldn’t. “Random luck and surviving,” he says, defines many who survive to be called heroes.

Aikins does offer one idea about those who help others and then live to be called heroes: they cultivate social bonds before and after the crisis. Service to the military or to a police department pays little in wages, but it can offer the remuneration of social ease and acceptance. In 2005, the Journal of Personalitypublished a study that examined why some non-Jews helped rescue people from the Nazis and why others did nothing. They found that those who had helped were more likely to report risk-taking behavior — but the strongest correlation was with those who said they interact with friends and family on a regular basis.

Defining a hero is harder than defining a coward — the latter of whom Ambrose Bierce got right: “One who, in a perilous emergency, thinks with his legs.” Those who saved people in Colorado and Wisconsin probably acted impulsively, unthinkingly, randomly — but they did not run for the exits.