(Time.com) -- On August 5, when a gunman drove to a Sikh temple outside Milwaukee and started shooting his 9mm 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, Colorado, 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 Psychology published a study by two psychologists who found that participants who were willing to endure pain -- having to put their hands into a tub of ice for 40 seconds, 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 Personality published 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.
This story was originally published on Time.com.
© 2012 TIME, Inc. TIME is a registered trademark of Time Inc. Used with permission.