Eventually, she stopped. It was just too exhausting. Some weeks later, she remarked: “It’s so strange. You get into that zone, and you know that the students around you think about things completely differently, and you really do wonder whether you are crazy.”

Whom does this intense imaginative immersion put at risk, and when? A study of the popular Internet game World of Warcraft suggests an intriguing answer.

World of Warcraft creates a landscape of craggy mountains, wastelands and castles, villages full of orcs and elves. Players create avatars who enter this world and interact with other avatars and fight monsters. It’s like finding yourself in “Lord of the Rings” and discovering that it’s your job to kill the huge venom-dripping spider that stands between you and your quest. At its peak, in 2010, there were more than 12 million players. (About half of all American adults play video games, and about one in five play almost every day or more.)

The anthropologist Jeffrey G. Snodgrass and his colleagues set out to study this complex social world. They found people who were relaxed and soothed by their play: “Sometimes I just log on late at night and go out by myself and listen to the soothing music.” Others felt addicted: “Once I start playing it’s hard to tell whether or not I’ll have the willpower to stop.”

What made the difference was whether people found their primary sense of self inside the game or in the world. When play seemed more important than the real world did, they felt addicted; when it enhanced their experience of reality outside the game, they felt soothed.

Prayer works in similar ways. When people use prayer to enhance their real-word selves, they feel good. When it disconnects them from the everyday, as it did for the student, they feel bad.

The imagination is a double-edged sword. It is, from a secular perspective, at the heart of what makes Mr. Gold’s god sufficiently real that he treats it as more than himself. But the capacity to make something real is not the same as the capacity to make it good or useful. That’s a caveat to bear in mind for any kind of prayerful life.