Researchers are discovering exercise—especially intense exercise—can be an effective part of treatment of addiction, but it isn’t the only part.

The solitary-confinement cell at Florence State Prison in Florence, Ariz., is 8 feet by 5 feet. It contains a bed and a toilet. Prisoners in the hole are permanently shackled, and they spend 23 hours a day in the tiny cell.

Michael Gonzales spent five years in that cell. He lost 60 lb. and got so pale he could see his veins through his skin. As far as Gonzales was concerned, prison was his life. He was serving a 36-year sentence, he’d been using drugs since he was 9, and he’d been in gangs since he was 12. Addicted to meth and heroin, deeply committed to gang life, he was a lost cause. History, statistics—everything—pointed to failure.

Few longtime addicts escape the clutches of addiction for good, but this year will mark seven years of sobriety for Gonzales. He’s been out of prison for five years. He has steady employment and a family.

Somehow, Gonzales beat the odds. So what’s his secret? Other than an iron will, it’s a combination of intense daily exercise, a strong community and 12-step meetings. Exercise on its own is not a cure for addiction, but growing evidence suggests it plays an important role in helping addicts recover and avoid relapse.

“CrossFit gives me an outlet,” Gonzales said. “It means the world to me. Without it, I would be using and back in jail.”