Nothing tests an investor’s mettle like a disaster, whether natural or man-made. The fear prompted by, say, the swine flu outbreak, Japan’s recent tsunami and nuclear disaster, or the Sept. 11, 2001, attacks can result in poor investing decisions. Understanding fear and its effect on markets — and on ourselves — can help us avoid panic selling. And mastering our fears may help us profit during troubled times.

If you have a hair-trigger reaction to danger, congratulations. You’re wired to survive. Humans have evolved so that we respond to danger before we can process it intellectually, thanks in large part to the amygdala, a small, almond-shaped mass deep within the brain. When something scary appears — a coiled snake at our feet, a drawn gun or even the look of fear on the faces of others — the amygdala jolts our system with stress hormones.

But sometimes our initial response is to underreact to a disaster, says Richard Peterson, a psychiatrist and managing partner of Market­Psych, a firm that measures market sentiment, including fear, trust and optimism. When we first try to understand the effect of a disaster, he says, we may go into denial or experience cognitive dissonance — holding conflicting ideas simultaneously. “People have trouble processing new information that is out of their comfort zone,” he says.

Once we incorporate the new facts, Peterson says, we react accordingly. For example, fund managers will sell stocks of companies that may be hurt by a disaster and buy those that may profit. This reaction stage may then be followed by an overreaction stage, or panic, perhaps four to five days after the event.

“Inevitably, you’ll get Chicken Little fears, such as worrying that a cloud of radiation will cover the world” in the case of the recent Japanese nuclear disaster. This fear may prompt you to sell risky assets and hoard safe ones.

Periods of panic give shrewd investors a chance to buy deeply discounted stocks. But it isn’t easy to take that risk. “Even some of the most experienced investors get a stomachache investing in those situations,” says Lauren Templeton, a hedge fund manager and the great-niece of the late Sir John Templeton. Uncle John, as she calls him, was one of the great investors of the 20th century and was well known for making steely decisions during a crisis. He famously borrowed $10,000 to invest in beaten-down U.S. stocks on the eve of World War II. He quadrupled his money.

Lauren Templeton says her first lesson in practicing what her uncle preached came in 2001, just months after she started her hedge fund. After the Sept. 11 attacks, with air traffic halted and the market plunging, her uncle had her place orders to buy top airline stocks selling at half their previous prices. They bought stock in American, Continental and US Airways; six months later, they sold, having made profits of 61 percent, 72 percent and 24 percent, respectively, she says.

Templeton, who teaches a course in behavioral finance at the University of Tennessee at Chattanooga, says you can train your brain to profit from catastrophes. She has repeatedly invested during times of crisis and reaped the rewards afterward. For instance, she says her funds scored big during the Toyota recalls in 2009 by buying Toyota stock near its nadir.

Templeton says you can learn to look forward to crises as opportunities and take fear out of the equation. Make a list of stocks you’d like to buy that are too expensive at the moment. Then place orders to buy the stocks if they fall, such as 30 percent below their current prices. “In a crisis situation, when you’re afraid to buy those stocks, it’s too late — the decision has been made,” she says.

Peterson also thinks fear-proofing is possible, to a point. “We can condition most of the fear out of us, but at some point the body will rebel against the brain,” he says. “When the information flow gets too grisly, turn it off.”

Frick is a senior editor at Kiplinger’s Personal Finance.