(CNN) -- When she was 12, Jennifer Traig's hands were red and raw from washing them so much. She'd start scrubbing a half an hour before dinner; when she was done, she'd hold her hands up like a surgeon until her family sat down to eat.
Her handwashing compulsions began at the time she was studying for her Bat Mitzvah. She was so worried about being exposed to pork fumes that she cleaned her shoes and barrettes in a washing machine.
"Like a lot of people with OCD, I tended to obsess about cleanliness," said Traig, now 42. "But because I was reading various Torah portions, I was obsessed with a biblical definition of cleanliness."
Family dinners were awkward for Tina Fariss Barbour, too, as an adolescent. She would concentrate so hard on praying for forgiveness that if anyone tried to interrupt her thoughts, she wouldn't respond.
"First I had to get rid of all my sins, ask forgiveness, do it in the right way, and then I had to pray for protection," said Barbour, now 50. "Or, if something bad happened to my family, it would be my fault because I had not prayed good enough."
The women come from different faith backgrounds: Barbour is Methodist and Traig is Jewish. But as children they believed fervently that they needed to conduct their own rituals and prayers, or else disaster would befall their families.
Both women say they suffered from a form of obsessive-compulsive disorder known as scrupulosity. A fear of sin or punishment from deities characterizes this condition, said Jonathan Abramowitz, professor and associate chairman of the department of psychology at the University of North Carolina, Chapel Hill.
Obsessive Compulsive Disorder, or OCD, involves unwanted thoughts ("obsessions") and accompanying behaviors called compulsions that patients use to reduce anxiety. In scrupulosity, the obsessions have a religious or moral underpinning.
Patients with scrupulosity often describe how they believe their thoughts are morally equivalent to actions, Abramowitz said. Psychologists call this phenomenon "thought-action fusion."
"Scrupulosity literally means 'fearing sin where there is none,' " Abramowitz and colleague Ryan Jacoby wrote in a recent article.
How common is this condition?
Scrupulosity is an understudied subcategory of OCD. Attempts at characterizing how many people might have this disorder, from the 1990s and early 2000s, suggested that somewhere between 5% and 33% of OCD patients have religious obsessions. Scientists are not sure what causes OCD, but they believe a combination of genetic and environmental factors may be at play.
In societies where religiosity is more stringent, the numbers are higher: 50% of OCD patients in Saudi Arabia and 60% in Egypt said they had religious obsessions, according to studies from the early 1990s.
A small number of people with scrupulosity are not religious at all, and a fear of moral transgression or inadvertently offending others weighs on their conscience, Abramowitz said.
Psychologists do not believe that religion causes people to develop OCD. However, religion may influence whether someone with OCD experiences obsessions and compulsions related to religion, Abramowitz said.
A tendency to get anxious and difficulties with uncertainty may factor into the condition, Abramowitz said. And, he pointed out, the vast majority of religious people do not have OCD.
Many "scrupulous" people Abramowitz has met consider religion to be an important part of their lives, but they may avoid institutions such as churches, synagogues or mosques because it reminds them too much of their anxieties.
"They're walking around with this black cloud of 'I'm going to hell,' " Abramowitz said.
Such a cloud has been been present for centuries. The OCD History Website cites passages from the first century priest and essayist Plutarch and sixth century monk John Climacus that could be interpreted as descriptions of scrupulosity.
St. Ignatius of Loyola, founder of the Jesuits, who died in 1556, appears to have suffered from the condition, said William Van Ornum, professor of psychology at Marist College. Ignatius wrote about his fears about stepping on something that looked like a cross.
There have also been suggestions that Martin Luther experienced scrupulous obsessions, Van Ornum said.
Robert Waters, a retired Lutheran minister, runs an online support network called The Scrupe Group. He said it has about 1,000 members, including Christians of several denominations, Jews, and at least one Hindu and one Muslim. Waters, who has suffered from scrupulosity personally, offers pastoral advice, but also tries to help people overcome their distrust of their own judgment.
"I think that's really a major part of it: To get to the point where people form their own consciences and don't rely on other people's," he said.
Did I do it right?
Scrupulosity often involves a lot of checking, Abramowitz said. Patients experience distress around the idea that they may have done something wrong or improper, so they may consult the Bible or religious authority figures often to see if they're doing things right. Consulting people and books isn't pathological, but in scrupulosity the behavior of checking is excessive compared to other religious people.
Barbour often confessed bad thoughts to her parents or religious leaders. Feelings of guilt followed her for years.
"OCD makes you think in black and white," she said. "There are no gray areas. Clean or not. Good or bad. There's nothing in between."
Barbour attended a religious school run by evangelical Christians. The altar calls, when the devout are asked to come forward and commit to Jesus Christ, heightened her anxieties about being good enough. She was also taught that if she had unforgiven sins, God could not hear her.
Her obsessions took a toll on schoolwork, too. Texts were difficult to read without reviewing the same passage over and over, a problem people with other forms of OCD experience.
Traig didn't have a complete Jewish education; she invented her own prayers to say three times a day, until a rabbi taught her the actual words. Rather than fearing sin, which has a distinct meaning in Christianity, Traig was worried she would be punished if she didn't practice her religion correctly.
"I couldn't have put my finger on what the punishment would be," she said. "Just a sense of doom."
When the space shuttle Challenger exploded in 1986, killing the crew of seven, Traig felt partially responsible.
Her OCD flared up around ages 12 to 13, and again from 16 to 17. With a Christian mother and a nonpracticing Jewish father, living in rural California, Traig didn't have many models of what Judaism could look like without constant anxiety about botching rituals.
Learning how to doubt in a healthy way
The form of cognitive behavioral therapy used with scrupulous patients is called exposure therapy. This involves the patient confronting what he or she fears: Namely, uncertainty.
Some people Abramowitz has worked with are anxious that they sometimes doubt their own belief in God. In therapy, they practice learning to live with the faith and uncertainty that normally surrounds religious beliefs.
"This is done by helping the patient to experience these types of uncertainties and learn that they, like any other religious person, can live with them comfortably," Abramowitz said.
Triggers of obsessive thoughts, such as a religious symbol or scriptural passage or even going to church, would be part of therapy.
"Faith is about being comfortable with your beliefs even if you can't have a 100% guarantee about things like hell, whether there is really a God, or what it means to be faithful enough," Abramowitz said. "You're taught to have faith, even though you cannot have scientific proof."
Keeping up religious traditions can be another source of anxiety.
Ultra-religious Orthodox Jews, for instance, follow strict rules about separating milk from meat, and some consider this tenet so sacred that they have separate refrigerators for meat and dairy. Some people with scrupulosity develop anxieties around this rule, going as far as to avoid the milk refrigerator altogether while carrying meat.
In exposure therapy, the patient might walk past the milk refrigerator while holding meat to confront her fear, Abramowitz said. That doesn't violate Jewish law, but confronts the fear of using the wrong refrigerator by mistake.
Some patients may also receive Selective Serotonin Reuptake Inhibitors, drugs that are also used to treat depression, according to the International OCD Foundation.
Treatment sessions are usually once a week, between 12 and 20 times, or five days a week for three weeks, Abramowitz said.
Members of the patient's faith community may be involved in the treatment, too.
Religious but without OCD
Overcoming scrupulosity does not need to mean giving up religion. Waters left the Lutheran church at age 19 in part because of his OCD, but returned in his mid-20s, and was inspired to go to seminary at age 31. He came to realize that faith is partly about letting go of the idea that any individual can control all circumstances or prevent every tragedy.
"The process of coming back to the church was as much a part of the recovery as the therapy was," he said.
Barbour got a diagnosis of OCD at age 26. She still slips into anxiety occasionally, but therapy has given her tools to fight back. Rather than trying to stop her obsessions, she imagines her thoughts flowing like a river, and takes deep breaths. She runs a blog called "Bringing Along OCD."
Traig did talk therapy, but not specifically for OCD. She overcame her thought and behavior patterns in college, when she had to live with others her own age and feared being socially ostracized. She wrote a book discussing her experiences called "Devil in the Details."
Today, she identifies with a blend of Conservative and Orthodox Judaism, and has a 3-year-old son and a 5-year-old daughter.
Her daughter can't read prayer books, but she'll announce "I have to go say my prayers!" and invent a chant.
Traig knows OCD has genetic links. She's also grateful that there's greater awareness and more treatment options for this condition than when she was a teen.
If her daughter's prayer antics ever turn obsessive, she said, "We're on that right away."