When it comes to easing symptoms of anxiety-related disorders, prayer may not have the same effect on everybody.

Researchers from Baylor University found that those who prayed to a loving and supportive God whom they thought would be there to comfort and protect them in times of need were less likely to show symptoms of anxiety-related disorders -- symptoms such as irrational worry, fear, self-consciousness, dread in social situations and obsessive-compulsive behavior -- than those who prayed but did not expect God to comfort or protect them.

In other words, what seemed to matter more was the type of attachment the praying individual felt toward God

"For many individuals, God is a major source of comfort and strength that makes the world seem less threatening and dangerous. Through prayer, individuals seek to develop an intimate relationship with God," researcher Matt Bradshaw said in a statement. "Those who achieve this goal, and believe that God will be there to protect and support them during times of need, develop a secure attachment to God. In this context, prayer appears to confer emotional comfort, which results in fewer symptoms of anxiety-related disorders."

He added that those who form avoidant or insecure attachments to a supreme being may feel like prayer is an "unsuccessful attempt to cultivate and maintain an intimate relationship with God. Rejected, unanswered or otherwise unsuccessful experiences of prayer may be disturbing and debilitating -- and may therefore lead to more frequent and severe symptoms of anxiety-related disorders."

For the study, researchers analyzed data from more than 1,000 individuals who participated in the most recent wave of the Baylor Religion Survey, completed in November 2010 by the Gallup Organization.

When it comes to personal prayer outside of religious organizations, however, findings by previous researchers have been inconsistent -- and puzzling. Some studies indicate frequent praying has positive effects on mental health; others report no effect -- or even that people who pray more often have poorer mental health than those who pray less frequently.

"At the present, we don't know exactly why the findings have been so inconsistent," Bradshaw said. "Prayer is complex."

The findings were recently published in the journal Sociology of Religion.