Americans have a complicated relationship with fear.

On the one hand, we enjoy fear enough to dedicate a holiday to it. This year, we will spend an estimated $9.1 billion celebrating Halloween. Horror films gross nearly half a billion dollars per year, and are known in Hollywood to have the best return on investment in the movie business. Quasi-dangerous activities like roller coasters are a big industry as well, following Hunter S. Thompson’s famous exhortation, “Faster, faster, until the thrill of speed overcomes the fear of death.”

These pursuits are occasions of “fake” fear. They simulate frightening circumstances that lie outside the realm of ordinary life, providing a fun shot of adrenaline without putting anyone in actual danger.

Real threats, however, are far less enjoyable. Not even roller-coaster fans look forward to losing their car’s brakes on a steep hill. To enjoy genuine mortal danger is considered abnormal: Indeed, in psychology, the “fear-enjoyment hypothesis” holds that pleasure from authentic fear increases along with sociopathic traits.

Given that real fear can be scarring and unpleasant, there’s a temptation to believe that the best way to deal with it is to avoid it at all costs. But science and philosophy often suggest otherwise. Fear can be one of the great sources of personal improvement. In particular, fear can help people cultivate several classic virtues that religious figures, sages, and secular moral traditions have all seen as essential for living a well-ordered life.

One such virtue is courage. The University of British Columbia psychologist Stanley Rachman, a leading expert on fear, has studied people in the world’s most dangerous professions, from bomb defusers to paratroopers. He has concluded that courage is misunderstood when it is defined as complete fearlessness. In his book Fear and Courage, Rachman makes the case that courage is not the absence of fear, but the decision to go forward in spite of it. Brave people are not merely numb to danger or discomfort; they feel and acknowledge fear, and just refuse to allow it to dominate their behavior.

By this definition, fear is not the antithesis of courage. It is courage’s necessary precondition. The German philosopher Josef Pieper writes in The Four Cardinal Virtues that a man can only show courage when he “walks straight up to the cause of his fear and is not deterred from doing that which is good.” For Pieper, this final qualifier is important: The confrontation of fear must be oriented toward the common good. In practice, this could mean confronting your fear on behalf of people weaker than you—for instance, risking physical harm to bring someone else to safety in an emergency, or speaking up to stop bullying. (This rules out extreme thrill seeking and other fear-provoking situations that are ultimately just entertainment.)

Fear also can signal where people need to do moral work on themselves. Buddhists, for example, believe that fear is a sign of attachment. According to the Buddha, the key to freedom from fear is to abandon “passion, desire, fondness, thirst, fever, and craving for sensuality.” There is a famous Zen Buddhist story about a band of samurai who ride through the countryside causing destruction and terror. As they approach a monastery, all the monks scatter in fear, except for the abbot. The samurai enter to find him sitting in the lotus position in perfect equanimity. Drawing his sword, the leader snarls, “Don’t you see that I am the sort of man who could run you through without batting an eye?” The master responds, “Don’t you see that I am a man who could be run through without batting an eye?”

For non-Buddhists, indifference to death might entail a bit more nonattachment than is optimal. But virtually every major faith and moral tradition preaches the same core principle. Christians and Jews see a similar connection between fear and the deadly sin of pride—“an excessive desire for one’s own excellence,” in the formulation of Thomas Aquinas. Modern research might back a connection like this up: Rankings of Americans’ top fears consistently reveal that one of their most prevalent social fears is public speaking. Presumably, the explanation is that people are abjectly terrified of humiliation in front of others. As Rousseau phrases it in his Confessions: “I was not afraid of punishment, I was only afraid of disgrace; and that I feared more than death, more than crime, more than anything else in the world.”

A few jitters before a big presentation is one thing. But a paralyzing horror of being judged by others? That seems to be a bright-red warning that too much of your identity is tied up with others’ esteem for you.

If fear is often a weed growing over the roots of attachment and pride, what can we do? Try taking inventory of your daily anxieties and worries. See which ones boil down quickly to your wealth, your looks, your reputation, your social status, or your influence. Then attack these inordinate attachments—and be grateful for the fear that led you to them.

John Bunyan wrote in The Pilgrim’s Progress in 1678 that fear “keeps the soul tender.” Properly understood, fear is good. So this Halloween, don’t settle for fake fear. Enjoy the haunted house, but then embrace the real thing.