See the rest of Slate’s Fitness Issue.

A few years ago, a team of Iranian scientists in the city of Isfahan put about two dozen male rats on a strict exercise program: The animals were forced to run on a treadmill, not unlike the ones in your local gym, at a gentle incline and for 90 minutes each day. After their workouts, the rats were allowed half an hour for a brief cool-down. Then they got high on drugs.

The point of the experiment was to show that an exercising animal—a real-life gym rat—would be less inclined to tap a lever for a dose of morphine. It wasn’t a new idea: The interplay of physical activity and the use of addictive drugs has been a subject of intense study for at least 20 years. Robin Kanarek of Tufts University, for one, has shown that spending time in a running wheel makes rats less susceptible to the effects of nicotine, morphine, and amphetamines. It’s also known that an animal with an exercise habit drinks less alcohol in its cage, and takes fewer bumps of cocaine. What about the rodents in Iran? Yes, they took fewer hits from the lever after their workouts.

Humans with drug problems might get some of the same benefits from working out. Habitual smokers report having fewer withdrawal symptoms and less intense cravings for a cigarette after they’ve been to the gym; even mild workouts and stretching can help stave off a relapse. (Efforts to get heavy drinkers into slimnastics have been less successful.) We’ve also heard that fitness routines can mend broken cortical circuits and stimulate the growth of new neurons. Apparently you can use exercise to “train your brain” to ward off dementia and depression, and treat the symptoms of ADHD. And it seems these benefits accrue whether you’re riding the elliptical or lifting weights.

But if exercise works as a treatment for drug addiction, we don’t know exactly why. It’s possible that a sweaty session at the club merely serves as a distraction: You’re not thinking about your next fix when you’re focusing on your next set. Or it could be that we use the gym to relieve stress, which is a major risk factor for backsliding into drug abuse.

There’s another, slightly more disturbing theory for why exercise helps stave off relapse—that working out helps people (and rats) resist drugs because of its similarity to those drugs. Have you ever felt irritable after skipping a yoga class or two? Or a little depressed and lethargic when you don’t have time for the gym? These might be construed as withdrawal symptoms—the eventual outcome of an activity or habit that mimics, in some important ways, the effects of morphine and cigarettes and dope. To put it another way—and maybe one that sounds less like vapid neuropunditry: Exercise may prevent drug use by helping us to replace one compulsive, feel-good behavior with another.

To be clear, exercise is not like heroin, at least not in the sense of fundamental psychopathology. And it’s best to avoid the semantic controversy over whether any behavior—weightlifting, shopping, eating, playing World of Warcraft—should properly be termed an “addiction,” or a “dependence,” or even appear at all, in the official manual of psychiatric diagnoses. But the story of how we came to think about the relationship between exercise and addictive drugs—the similarities between them, and the ways they interact—is worth telling.

It begins about 35 years ago, with a peculiar confluence of trends in neurobiology and popular culture. First, the science: In 1973, researchers discovered that we all have a set of opiate receptors in our brains, some of which can be found in a kind of “pleasure center” for neural activity. That mesolimbic reward pathway could be engaged by normal and natural stimuli, they realized—such as listening to music or eating ice cream—but it could also be hijacked by certain drugs that send it into overdrive. According to the theory, everything that felt good had something to do with this basic system in the brain.

The idea of a common reward system opened the door for new varieties of addiction: If drugs could overwhelm the brain’s reward pathway, what about compulsive behaviors? Over the next few years, psychologists delivered a cascade of new behavioral diagnoses. In 1978, it was proposed that for some people, sex might act on the brain in the same way as morphine; “Don Juanism” was reconstrued as “sex addiction.” By 1980, doctors had given “pathological gambling” its own formal diagnosis. And more behavioral addictions were soon to come.

Meanwhile, another trend was rapidly gaining momentum during the Carter years. As Gina Kolata outlines in her book, Ultimate Fitness, Americans were exercising in record numbers. And not just any which way—people were putting on athletic shoes and running like crazy. Kolata cites a Frank Deford article from Sports Illustrated in 1978: “I am sick of joggers and I am sick of runners,” he wrote. “I don’t care if all the people in the U.S. are running or planning to run or wishing they could run. All I ask is, don’t write articles about running and ask me to read them.” In the early 1960s, there were 100,000 self-identified runners in the nation. By the late 1970s, there were 30 million.

It wasn’t long before the ranks of psychologists and packs of joggers ran headlong into one another. More and more people were working out, and clinicians noticed that some of them were hurting themselves. What’s more, their devotion to marathon training or aerobics was taking on some of the qualities of an addiction: Runners claimed to experience a “natural high,” and some were steadily increasing their distances to achieve the same level of satisfaction. Scientists wondered if this had something to do with one of the body’s naturally occurring pleasure peptides, the beta-endorphin, which gets released during exercise. (Endorphin is a shortened version of the “endogenous morphine.”) Were runners getting “addicted” to endorphins? Sometimes they showed signs of withdrawal—increased anxiety and depressive tendencies—when they missed a visit to the track.

Soon these obsessive joggers were being described as victims of an exercise addiction, though in deference to diagnostic conservatives their affliction was also termed obligatory exercise, overtraining syndrome, or exercise dependence (the “other” ED). Some researchers felt the condition was merely an outgrowth or subset of anorexia nervosa and declared the combination of undereating and overtraining responsible for the Female Athlete Triad, or FAT. (Its three components are disordered nutrition, amenorrhea, and osteoporosis.) And since men were diagnosed as anorexics less often than women, it was further proposed that overtraining might be the masculine version of an eating disorder.

(In the following ngram, I’ve plotted the concurrent rise of the phrases brain reward system, recreational runners, and exercise addiction in Google Books.)

What’s more, a very similar and startling phenomenon had been demonstrated in rodents. In 1967, a pair of psychologists at Northwestern developed a standard procedure for inducing a kind of overtraining syndrome in the lab: Under the right conditions, a captive rat would become exorexic. The scientists noticed that if they limited a rat’s access to food to one hour per day, the animal would start to lose weight before adapting to the new schedule and consuming more food when it had the chance. But if they gave that same rat the opportunity to exercise in a running wheel, it never adjusted. Instead, the rat would get slightly deranged: running more and more, and eating less and less, until it became too scrawny and weak to move. Without intervention, the animal would starve to death within two weeks.

Further studies revealed that rats derived some kind of pleasure from running on the wheel, or at least they could become dependent on the behavior. The Lewis strain of lab rats, for example, is especially prone to drug addiction. Lewis rats are also inclined to habitual exercise: When given regular access to a wheel, they’ll engage in longer and longer bouts of running, until they’re doing more than 6 miles per day. (That’s a serious haul for a critter with tiny legs.) Rats of the Fischer strain, which aren’t as likely to press a lever for drugs, also aren’t as vigorous on the wheel—they only run for about a mile. Rats can also be trained to do things in exchange for access to the running wheel, too. Instead of a food pellet reward, they get the chance to exercise.

The fact that rats find physical activity rewarding doesn’t mean they’re always killing themselves by doing too much of it. Aside from its many well-established physical effects, exercise provides mental benefits for rats as well as people. It staves off melancholy and anxiety, for one thing, and seems to improve the well-being of a particular strain of rat—the Flinders sensitive line—that’s been bred as a model of human depression. (The animals are usually sluggish, with sleeping problems and small appetites.)

So is exercise a kind of “positive addiction,” as William Glasser put it in 1976—a habit-forming behavior that can displace a habit-forming substance or mitigate its negative effects? What should we make of the many similarities between the biochemical effects of exercise and those of the drugs of abuse? Both stimulate the release of dopamine and neuropeptides in the striatum; both lead to changes in brain circuitry and the formation of new neural connections; both apparently induce tolerance, and—in some cases—withdrawal symptoms and physical injury. Yet as Vaughan Bell has pointed out in Slate, there’s no straightforward relationship between brain chemicals and addiction, and knowing a bit of neurochemistry doesn’t tell you whether an activity is harmful or beneficial. To take just one of many examples, falling in love might lead to dopamine release, and an unexpected breakup could produce very real feelings of withdrawal. Do we wring our hands and wonder whether love is an addiction?

It would be silly—and very unhealthy—to avoid exercise on account of its habit-forming properties. But we shouldn’t ignore the facts. A regular exercise program may improve your mood and prolong your life. It may help you quit smoking and keep your wits about you as you age. That doesn’t mean it’s unreasonable to weigh the bad against the good, however. I try to go to the gym three or four times per week, and I get a little annoyed when I can’t make it. That’s OK; the downside is worth it. But a few years ago, I was addicted to stretching, too: Every morning, I’d spend 15 minutes limbering up before leaving the house. It felt great when I did it, but terrible if I missed a day. I’d twist my legs under my desk for hours, trying to make my calves less stiff and my joints less creaky. That would have been a small price to pay, I suppose, if stretching offered some other, more important benefit. But when I discovered that it doesn’t actually prevent sports injuries, the whole thing started to seem like a bad habit. So one day I quit. Cold turkey.

Like Slate on Facebook. Follow us on Twitter.