Deep inside a dark cave in Thailand, 12 lost boys and their soccer coach used meditation to keep calm while they awaited rescue. It may have helped save their lives.

The boys, ages 11 to 16, were exploring an underground cave after their soccer practice on June 23 when they were trapped due to a flash flood caused by monsoon rains. When rescuers found the group, 10 days after they went missing, they were not frantic or crying; they were reportedly sitting quietly and meditating.

The 25-year-old coach for the Wild Boar team, Ekapol Chanthawong, taught the boys to meditate to keep them calm and preserve their energy while awaiting rescue. He trained in meditation as a Buddhist monk before becoming a soccer coach, Vox reported.

Stanford University meditation expert Leah Weiss, who was taught by the Dalai Lama, told CNBC that Buddhists often meditate when they are distressed or in danger.

With no food and depleting oxygen, the practice likely made a difference.

Meditation can slow down the heart rate, breathing and metabolism. It lowers cortisol — often called the stress hormone — and decreases use of oxygen and output of carbon dioxide, Weiss said.

It may also have helped solidify their feelings for each other.

Richard Davidson, a neuroscientist at the University of Wisconsin, studied meditation and the "startle response." His results, published in 2012 in the journal Emotion, found that there was increased activity in two brain areas known to be involved in empathy, the Independent reported.

Chanthawong was orphaned at age 12 and spent 10 years living in a monastary before leaving to take care of a sick grandmother.

"He could meditate up to an hour," his aunt, Tham Chanthawong told the Associated Press. "It has definitely helped him and probably helps the boys to stay calm."

The youngsters and their coach are currently hospitalized in an isolation ward to monitor for infections, and are reported to be in good physical condition.

A psychiatrist who was attending to the boys as they recovered said they are sleeping well and not showing symptoms of stress.

They are expected to remain in the hospital for about a week and then return home to rest for about 30 days, according to news reports.