This article is an excerpt from Atomic Habits, my New York Times bestselling book.

In 1971, as the Vietnam War was heading into its sixteenth year, congressmen Robert Steele from Connecticut and Morgan Murphy from Illinois made a discovery that stunned the American public. While visiting the troops, they had learned that over 15 percent of U.S. soldiers stationed there were heroin addicts. Follow up research revealed that 35 percent of service members in Vietnam had tried heroin and as many as 20 percent were addicted—the problem was even worse than they had initially thought.1

The discovery led to a flurry of activity in Washington, including the creation of the Special Action Office of Drug Abuse Prevention under President Nixon, to promote prevention and rehabilitation and to track addicted service members when they returned home.2

Lee Robins was one of the researchers in charge. In a finding that completely upended the accepted beliefs about addiction, Robins found that when soldiers who had been heroin users returned home, only 5 percent of them became re-addicted within a year, and just 12 percent relapsed within three years. In other words, approximately nine out of ten soldiers who used heroin in Vietnam eliminated their addiction nearly overnight.3

To Change Your Behavior, Change Your Environment

Robins' finding contradicted the prevailing view at the time, which considered heroin addiction to be a permanent and irreversible condition. Instead, Robins revealed that addictions could spontaneously dissolve if there was a radical change in the environment. In Vietnam, soldiers spent all day surrounded by cues triggering heroin use: it was easy to access, they were engulfed by the constant stress of war, they built friendships with fellow soldiers who were also heroin users, and they were thousands of miles from home. Once a soldier returned to the United States, though, he found himself in an environment devoid of those triggers. When the context changed, so did the habit.

Compare this situation to that of a typical drug user. Someone becomes addicted at home or with friends, goes to a clinic to get clean—which is devoid of all the environmental stimuli that prompt their habit—then returns to their old neighborhood with all of their previous cues that caused them to get addicted in the first place. It’s no wonder that usually you see numbers that are the exact opposite of those in the Vietnam study. Typically, 90 percent of heroin users become re-addicted once they return home from rehab.4

The Secret to Self Control

The Vietnam studies ran counter to many of our cultural beliefs about bad habits because it challenged the conventional association of unhealthy behavior as a moral weakness. If you’re overweight, a smoker, or an addict, you’ve been told your entire life that it is because you lack self-control—maybe even that you’re a bad person. The idea that a little bit of discipline would solve all our problems is deeply embedded in our culture.

Recent research, however, shows something different. When scientists analyze people who appear to have tremendous self-control, it turns out those individuals aren’t all that different from those who are struggling. Instead, “disciplined” people are better at structuring their lives in a way that does not require heroic willpower and self-control. In other words, they spend less time in tempting situations.5

The people with the best self-control are typically the ones who need to use it the least. It’s easier to practice self-restraint when you don’t have to use it very often.6 So, yes, perseverance, grit, and willpower are essential to success, but the way to improve these qualities is not by wishing you were a more disciplined person, but by creating a more disciplined environment.

This counterintuitive idea makes even more sense once you understand what happens when a habit is formed in the brain. A habit that has been encoded in the mind is ready to be used whenever the relevant situation arises.7 When Patty Olwell, a therapist from Austin, Texas, started smoking, she would often light up while riding horses with a friend. Eventually, she quit smoking and avoided it for years. She had also stopped riding. Decades later, she hopped on a horse again and found herself craving a cigarette for the first time in forever. The cues were still internalized; she just hadn’t been exposed to them in a long time.8

Once a habit has been encoded, the urge to act follows whenever the environmental cues reappear. This is one reason behavior change techniques can backfire. Shaming obese people with weight loss presentations can make them feel stressed,9 and as a result many people return to their favorite coping strategy: overeating. Showing pictures of blackened lungs to smokers leads to higher levels of anxiety, which drives many people to reach for a cigarette.10 If you’re not careful about cues, you can cause the very behavior you want to stop.

Bad habits are autocatalytic: the process feeds itself. They foster the feelings they try to numb. You feel bad, so you eat junk food. Because you eat junk food, you feel bad. Watching television makes you feel sluggish, so you watch more television because you don’t have the energy to do anything else. Worrying about your health makes you feel anxious, which causes you to smoke to ease your anxiety, which makes your health even worse and soon you’re feeling more anxious. It’s a downward spiral, a runaway train of bad habits.

Researchers refer to this phenomenon as “cue-induced wanting”: an external trigger causes a compulsive craving to repeat a bad habit. Once you notice something, you begin to want it. This process is happening all the time—often without us realizing it. Scientists have found that showing addicts a picture of cocaine for just thirty-three milliseconds stimulates the reward pathway in the brain and sparks desire.11 This speed is too fast for the brain to consciously register—the addicts couldn’t even tell you what they had seen—but they craved the drug all the same.

Here’s the punchline: You can break a habit, but you’re unlikely to forget it. Once the mental grooves of habit have been carved into your brain, they are nearly impossible to remove entirely—even if they go unused for quite a while. And that means that simply resisting temptation is an ineffective strategy. It is hard to maintain a Zen attitude in a life filled with interruptions. It takes too much energy. In the short-run, you can choose to overpower temptation. In the long-run, we become a product of the environment that we live in. To put it bluntly, I have never seen someone consistently stick to positive habits in a negative environment.

A more reliable approach is to cut bad habits off at the source. One of the most practical ways to eliminate a bad habit is to reduce exposure to the cue that causes it.

If you can’t seem to get any work done, leave your phone in another room for a few hours.

If you’re continually feeling like you’re not enough, stop following social media accounts that trigger jealousy and envy.

If you’re wasting too much time watching television, move the TV out of the bedroom.

If you’re spending too much money on electronics, quit reading reviews of the latest tech gear.

If you’re playing too many video games, unplug the console and put it in a closet after each use.

Self-control is a short-term strategy, not a long-term one. You may be able to resist temptation once or twice, but it’s unlikely you can muster the willpower to override your desires every time. Instead of summoning a new dose of willpower whenever you want to do the right thing, your energy would be better spent optimizing your environment. This is the secret to self-control. Make the cues of your good habits obvious and the cues of your bad habits invisible.

This article is an excerpt from Chapter 7 of my New York Times bestselling book Atomic Habits. Read more here.