Whether solo, jogging in a crowd, or lost in the sensation of music thumping through his headphones, Danny Dwyer sees his thorny past, thankful present and unwritten future blend to form the perfect sanctuary.

This is how he trains for this year's Boston Marathon.

Each step is one away from battles with drug addiction that began when he was 8 years old. It's a struggle that's swallowed up a coveted job with the Boston Police Department and an engagement. For four years, he lived under a bridge. Now, he's rededicated his life to helping others who struggle with substance abuse.

"I can give you many low points. That's the thing about addiction," Dwyer says. "If you don't do something about it, the low point you've reached — it'll go lower."

Born in Dorchester, Massachusetts, Dwyer was the youngest of three children. His sister, Barbara, was seven years older and his brother, Billy, was five years older.

His parents divorced when he was about 6, and his mother, Frances, moved with Danny and Billy to Los Angeles.

While she worked several jobs over next two years, her sons became latchkey kids. They often hung out with older kids near their home in a poorer area of town. Those kids introduced him to marijuana.

"It's pretty wild when you think about it," Dwyer said. "To be out until 1 o'clock in the morning, skateboarding on a school night, smoking marijuana. To then being in second grade the next day practicing penmanship."

Four years later they returned to Massachusetts, but alcohol, marijuana and cocaine stayed part of Dwyer's life.

His mother sent him to live with his father, William, and he attended an all-boys Catholic high school where he was exposed to people working toward college.

Though he was still smoking pot and drinking, he entered the Air Force National Guard out of high school.

He struggled on and off for a few years, but had completely put everything down by 1988 when he went active-duty Army. It offered him a combat medic position and he was assigned to the prestigious 10th Mountain Division in Ft. Drum, New York.

No one suspected anything about his past drug use.

"They ask you. You say no," Dwyer said. "You do what you have to do."

Out of the Army and still sober in 1996, he spent three years working for the Suffolk County Sheriff's Department before being called by the Boston Police Academy.

During a training session he partially tore his ACL and was put on painkillers. Still, he graduated at the top of his class for physical fitness.

Then everything changed.

Assigned to the plain-clothes division even before his probationary year was complete, he injured his knee again chasing a suspect. Unable to walk, he was taken to the hospital and treated with painkillers OxyContin and Percocet.

"I never really recovered from that," Dwyer said. "I wish I could explain what happened. But I got lost in it."

Eleven years of sobriety were gone.

He tried to pull it together, but when he returned to duty withdrawal took hold. He bought painkillers illegally off the street. When pills were too expensive, he turned to heroin.

One day in 2001 he wound up buying from a dealer who was under surveillance. He was arrested and fired. He split with his fiancé, left the house they shared, and started staying in his car.

After burning through his money he found himself under the Charlestown Bridge.

"There was a time I thought I'd lost him. A couple of times," his father, William Dwyer recalled. "When he needed money or got in a jam I'd support him. But I didn't know where he was."

Once, William found out Danny was at a shelter and brought him things. But interactions like those were few.

Dwyer went through numerous detoxes, but "the shame and guilt, it was horrible," he said. Sometimes he was lined up for further treatment. Other times he simply left.

A stint at a halfway house finally stuck, and he got sober, becoming a drug and alcohol counselor. After a few more relapses, his first son, Danny Jr. was born in 2006. His second son, Luke was born two years later.

"The one thing I knew is that I needed to try to give these kids the best shot at not going down a path that I went down," Dwyer said.

Around that time Dwyer began to take up yoga, and he was soon offered a job managing 13 studios.

Then, 10 months ago he first got serious about running.

He was dealing with a shoulder issue. But he knew surgery would mean doctors prescribing narcotics, so he initially used yoga as a less-evasive solution.

But the shoulder issue persisted.

He had surgery, and was supposed to be in a sling six weeks. He took it off after just three days and flushed his medication down the toilet.

Within five days he was running, staples and all still in his shoulder.

He started running 5k races, then a half-marathon. Through his volunteering connections at recovery programs, he will run the Boston Marathon for a homeless shelter, Lazarus House, and accepted its $10,000 fundraising commitment.

His father said helping is like therapy for him. "He's getting a lot of help and he's giving a lot of help," William Dwyer said.

Danny has also started Frontline Yoga, aimed at more face-to-face interaction with the homeless community. One way it does that is by passing out yoga mats and holding free yoga sessions. Dwyer's sons often come with him, bridging the gap between his past and present.

"It'll be pieces of my life that when they're older...they'll have something to look at," Dwyer said. "They'll know that there is a way out and their dad made it out."