Mug shots of triathlete Shane Niemeyer, who survived four overdoses and went through five rehabilitation efforts without success while compiling a lengthy rap sheet.

Shane Niemeyer, 38, poses at his Boulder home with wife Mandy McLane, who also competes in triathlons. "Life is great. It's much better than I ever envisioned. There are times I have to pinch myself," Niemeyer says.

Shane Niemeyer is a former heroin addict but now is an avid triathlete who will be competing Sunday in Boulder in the Ironman Triathlon.

BOULDER — Shane Niemeyer decided to become a triathlete when he was under arrest in a medical unit at the Ada County Jail in Boise, Idaho, days after a failed suicide attempt driven by heroin addiction and hopelessness.

Now the Boulder triathlete uses the story of his metamorphosis from junkie to Ironman to give others hope of redemption. He knows how it feels to be hopeless, enough to use an extension cord as a noose in a bid to end it all.

If that cord hadn’t broken Oct. 23, 2003, he wouldn’t be here to explain how he fixed his broken life: By deciding to pursue the Ironman triathlon — a 2.4-mile swim, 112-mile bike ride and marathon run (26.2 miles) — after reading a story about Boulder Ironman Dave Scott in Outside magazine while he was on suicide watch.

Niemeyer began training in jail while awaiting a prison sentence for felony drug offenses, starting with three sets of six push-ups and three sets of eight sit-ups, his body a “toxic organism” that weighed 220 pounds.

For a man who saw himself as a “parasite” and believed he was “irredeemable,” tri- athlon would help him earn self-esteem he lacked when he tried to “stop the noise” in his head and kill himself.

“Right before I jumped with that noose around my neck, I really did think there were no redemptive qualities in my life,” said Niemeyer, who will compete in his 15th Ironman on Sunday in Boulder. “I distinctly remember feeling I had fallen too far, that things had gone to a point where it was hopeless, and hopelessness is, I think, the worst place a human being can find himself. Loneliness and hopelessness, and that’s where I was.”

A resident of Boulder since 2007, Niemeyer has been married two years to “an All-American golden girl” who is a professional triathlete and speech pathologist, and who sometimes does modeling gigs. He has published an autobiography, “The Hurt Artist: My Journey from Suicidal Junkie to Ironman,” which came out in May.

“He’s always wanted to reach out to people, because his biggest problem was his self-esteem,” said his wife, Mandy McLane. “Because his self-esteem was so low, that was what was making it really hard for him to wrap his head around what we would call normal stress. He’s really been able to relate to individuals going through troubled times. He knows it’s possible to get out of it, but they need help. And help is giving them hope, to see there is light at the end of the tunnel.”

He didn’t know that before he tried to kill himself while in jail. Having had a troubled childhood, he turned to alcohol and drugs. He survived four overdoses and went through five rehabilitation efforts without success while compiling a lengthy rap sheet.

But when he was emerging from heroin withdrawal after the failed suicide attempt, he saw the story about Scott and was intrigued by the notion of becoming an Ironman. Seemingly a superhuman event, it would not only give him self-esteem, it would fill his free time after he got out of prison. Better to be obsessed with working out than strung out on drugs.

“Emerson says a man is what he thinks about, all day long,” said Niemeyer, 38. “All I had thought about from the time I woke up until the time I went to bed (was) how I was going to get high, how I was going to get money to make it work. I couldn’t just remove that. I’m sitting in a cell thinking, ‘What am I doing to do with my life?’ That article seemed like, ‘Well, that’s something, right?’ “

The first simple workout in jail of a few push-ups and sit-ups gave him a sense of achievement, a spark of confidence. He saw “shoots of hope” and kept at it. He served 14 months in prison and walked out at age 29 with clothes that didn’t fit and $212. His defense attorney let him sleep on his couch in Boise. He got jobs washing dishes. He bought a bike and trained to be a triathlete.

Six months after he got out of prison, he did a half Ironman in Sunriver, Ore., finishing in 5 hours, 8 minutes. Two months after that he did his first Ironman in Santa Rosa, Calif., finishing in 11 hours, 14 minutes.

In May 2013, at the Ironman Texas near Houston, Niemeyer finished 19th among more than 1,500 men with a time of 9:14 on a day when the temperature soared into the 90s and humidity put the heat index near 100. Seventeen percent of the field didn’t finish.

“I’m living this life I envisioned in prison,” Niemeyer said. “It’s hard to fathom what my life was once, devoid of any kind of meaning, and now — the woman I’m married to, the people I’m surrounded by — I wonder: How does that work?”

He wonders why he survived his suicide attempt by pure accident when that cord broke. He believes a higher power intervened. Sometimes he thinks about men he knew when he was a drug addict who died.

“I was the craziest of them all,” Niemeyer said. “Why did I not? Life is great. It’s much better than I ever envisioned. There are times I have to pinch myself. It’s hard to imagine, how did I live the way I did? It’s a very interesting dichotomy. It’s crazy.”

John Meyer: 303-954-1616, jmeyer@denverpost.com or twitter.com/johnmeyer

The Post's ski and Olympics writer, Meyer covered his 12th Games last summer in Rio de Janeiro. He has covered five World Alpine Ski Championships and more than 100 World Cup ski events. He is a member of the Colorado Ski & Snowboard Hall of Fame and Colorado Running Hall of Fame. He regularly covers running and the Colorado Rapids.

CenturyLink, the telecommunications company that ended its sponsorship agreement with Broncos linebacker Brandon Marshall because of his protests during the national anthem last year, said it will not terminate its agreement with current client Emmanuel Sanders.