(CNN) Images of Turkey are exotically beautiful to many people: Vibrant poppy fields, multispired mosques and of course the mystical whirling dervishes. Though the twirling figures in white appear mysterious, the origin of the dervish ceremony lies in an experience familiar to most of us: love and loss.

The owner of this broken heart was Hazreti Mevlana Jelaluddin Rumi, more commonly known by his last name. His teachings are the foundation for the Mevlevi order of Sufism, which aims to find knowledge of Allah not only through books but through direct personal experience.

Born in 1207 in what's now Afghanistan, Rumi escaped the Mongol invasion and settled eventually in Konya, located in present-day Central Anatolia, Turkey, according to Sheikh Abdul Azziz , a Melbourne-based teacher of Mevlevi Sufi.

His father, from a family of religious teachers, guided Rumi through retreats, devotional acts and other traditional methods of learning. Yet it was only after his encounter with a sheikh called Hazreti Shamsuddin of Tabriz that Rumi was transformed into a spiritual leader who inspired a separate tradition.

Shamsuddin was a powerful sheikh whose name means "the sun," Azziz explained in an article in Sufism: An Inquiry, a journal for studies in self-knowledge. Rumi, who was 37 when they met, abandoned his students and his own leadership role among them to follow Shamsuddin, who "lit the fire of mystic love" within him, according to Azziz.

Rumi and Shamsuddin "closeted themselves away for many months," Azziz wrote. Secluded together, the two men reportedly spoke of their love of God.

Their union lasted about three years. And then Shamsuddin disappeared.

Some believe that Rumi's students killed Shamsuddin, according to the Dervish Retreat Center , a Sufi cultural center in Spencer, New York. No one knows today.

What is known, though, is that this abrupt departure helped transform Rumi into the spiritual leader who would inspire a Sufi order, the main feature of which is the "sema" or whirling dervish prayer.

A moving mediation

The spinning ceremony is a "dhikr," a remembrance of God, intended to clear the mind and cleanse the heart in preparation of hearing the guiding voice. As they twirl, each dancer's concentration is fixed on Allah.

Inspiration for the "turn" struck Rumi in a marketplace, where he encountered the rhythmic hammering of the gold-beater's apprentices, according to Azziz. Hearing the rhythmic hammering, Rumi heard the dhikr, and so he slowly opened his arms and began to turn around and around in ecstasy: Allah, Allah, Allah.

"Sema is to struggle with the notion of one's self, like a dying, bloodstained bird, fluttering in the dust," Rumi wrote.

In the hundreds of years since Rumi's death in 1273, the sema has been refined and ritualized by his family and followers. Today, the headdress worn by the dervishes represents a tombstone of the ego; the white skirt symbolizes the ego's shroud. The rotations, up to 30 per minute, are always counterclockwise.

The ceremony has spiritual meaning for those in the Mevlevi order, yet it may also impart other benefits. Fadel Zeidan , an assistant professor in the Department of Anesthesiology at the University of California, San Diego, said there is evidence that movement meditations -- sema may be considered one -- can have "benefits on health as a whole."

Learning to unlearn helplessness

"Mindfulness-based practices are basically where an individual can develop attentional stability by concentrating on a meditative object," explained Zeidan, who could not speak to sema specifically, as he has not researched and tested the practice. "Traditionally, it's the breath.

"When you repeatedly train your attention to focus on something like the breath, you're teaching your mind to be more flexible and more controlling ... of the thoughts that arise," he said. Mindfulness also includes acknowledging the distracting thoughts, feelings and emotions that intrude on your moment-to-moment experience and teaching yourself to accept and let go of those intrusions.

"What we start to see is that mental training looks very similar to physical training," he said. The mind becomes stronger, "just like working out a bicep."

Sema requires attentional control and escape from distractions. Any well-being that may wash over the whirling dervishes, then, would not be produced by "transcendence or bliss or God or something," Zeidan said. "It's the fact that the individual is training themselves to control their thoughts and to control the emotions that arise."

For people in chronic pain, control can be particularly important because their physical ailments constantly intrude on their thoughts, he added. "As time passes, they become more anxious, more depressed. They become more sedentary because they fear movement, they fear injuring themselves -- and this is how chronic pain develops."

Learning how the ancient practices work

Exercise is the most powerful behavior change you can make to handle pain, Zeidan said. Exercise not only increases your "positive mood," it helps you lose your fear of movement. "When you combine that with mental training like a mindfulness-based approach, you're basically optimizing and compounding these two powerful interventions." Mindfulness training increases your "locus of control," or personal agency, while reducing your helplessness, Zeidan said.

Get CNN Health's weekly newsletter Sign up here to get The Results Are In with Dr. Sanjay Gupta every Tuesday from the CNN Health team.

One of his biggest research discoveries is that "mindfulness does not use the body's opiate system to reduce pain." Our bodies release opiates to assuage pain, he explained: "You stub your toe, you're in pain, and your body releases a cascade of endogenous opiates."

"We discovered that mindfulness does not use the primary pain modulatory system, the opiate system; it uses something else," Zeidan said. "We don't know what it is yet. We're working on this. But it gives credence to the fact that there's something novel here with these very old techniques."

Novel, true. And arguably strong enough to mend at least one broken heart.