Teenage boys shuffle into a cramped room. Wearing the same navy blue sweatpants and white undershirts, they sit cross-legged on yoga mats laid out on the floor. Thick scars on forearms and biceps are apparent as they stretch their hands to their knees and shut their eyes.

Yoga instructor – and ex-convict – Fredy Díaz Arista begins guiding a meditation aimed at relaxing the group of 10 young offenders. Among them and their peers, about 300 youth in this Mexico City jail, the crimes range from drug abuse to robbery, assault, and murder.

“How long can you stand yourselves with your eyes closed?” Mr. Díaz asks, and then he reminds the boys to breathe. “Inhale. Exhale.”

Díaz spent six years and seven months in a prison known as Atlacholoaya in the state of Morelos, just south of Mexico’s capital city. He was picked up for trafficking marijuana and sentenced to 10 years.

In jail, he discovered yoga, and his life changed radically. He was released in 2009.

“I feel compelled to give back what was given to me,” Díaz says. “Yoga was the key that opened my heart.”

The yoga program in Atlacholoaya was founded in 2003 by Ann Moxey, a yoga instructor and psychologist specializing in addictions. Mexican prisons are rife with drugs, making rehabilitation especially hard. Ms. Moxey’s yoga classes helped Díaz break the cycle.

Today yoga is taught in two juvenile jails and one adult prison in Mexico City, and in adult prisons in the cities of San Miguel de Allende, Guadalajara, and Puebla. In the adult prison in Morelos, and inspired in part by the success of Díaz, Moxey has created a program to train inmates to become yoga instructors. About 20 men have joined.

“If you train them, and if you give them the tools,” she says, “and you give them jobs in which they can give back to society, you actually close the energetic circle and what used to be the problem is now the solution.”

Díaz in particular “really has the ability to make a class become a poem,” Moxey says.

The boys at the youth detention center where Díaz teaches have lived life faster than most. Some are fathers; some have fired weapons; some have faced down crippling addictions.

Díaz says he has seen his classes deliver positive results. In the past year, four boys have left jail and kept in contact with him; one is practicing yoga on scholarship at a local studio and says he wants to teach.

Díaz says he tells his students that it’s not just about yoga – that whatever they do, if they embrace their ideals and do it with heart, they can protect themselves against life’s hardest knocks.

• Sign-up to receive a weekly selection of practical and inspiring Change Agent articles by clicking here.