Although the earliest psychoanalysts saw religion as neurotic, the modern mental health field has stopped pathologising religious beliefs. Contemporary systems of psychiatric diagnosis have no problem with a belief in God, Zoroaster, Demeter, or the Moon Goddess. At least in theory, we are free to hold whatever religious beliefs we wish without fear of being labelled mentally ill.

However, the field has made less progress when it comes to actual religious experiences. Patients meet with less tolerance when they reveal that Jesus is speaking to them, right now, in the consulting room, or that the Moon Goddess flew in through their bedroom window last night and initiated a lunar romance. When spirituality makes the leap from an abstract belief to a real, live experience, therapists get nervous.

The science-fiction writer Philip K Dick puzzled over the distinction between mental illness and religious experience after he had one himself. He claimed that, while he was recovering from dental surgery in February 1974, his consciousness was awakened by a mysterious flash of pink light. After the pink flash, he had visions of abstract paintings and unfamiliar engineering blueprints. Streams of fiery energy – of ‘liquid fire’, he said – seemed to weave through his environment and inhabit his body. He saw scenes of ancient Rome superimposed over his neighbourhood: ‘I looked around and saw Rome! Rome everywhere! Power and force, stone walls, iron bars.’

A local daycare centre appeared to be a Roman prison. To Dick, its children were Christian martyrs to be fed to lions. Pedestrians on the sidewalk seemed to be wearing Roman uniforms. The totalitarian Roman Empire had returned, and Dick felt he was secretly a spiritual warrior doing battle with it. In a letter to a friend, he wrote: ‘At last Rome began by stealthy degrees to surface once more, to manifest itself. Therefore it is not surprising that the same Holy Spirit which rose against it then… has returned to arouse us as before.’

Although the visions eventually vanished, Dick remained fascinated by them. So captivated was he that he wrote an 8,000-page commentary he called his Exegesis. As a science-fiction writer, Dick had trained his imagination to explore every possibility, however unlikely. Accordingly, many of his conjectures about the origin of the pink light are bizarre. One of his theories posited that an extraterrestrial being symbiotically attached itself to his brain and telepathically linked him with individuals from various time periods. One of them was a first-century Christian revolutionary named Thomas. It was through Thomas, Dick supposed, that the Roman visions came.

Another theory had it that, in an alternate dimension, Dick actually was a Christian revolutionary and the Roman visions were encounters with his other-dimensional alter ego. Or perhaps Rome was a malevolent cosmic entity that resided in a dimension orthogonal to linear time, tyrannising multiple time periods simultaneously. On the other hand, maybe the whole affair was an illusion resulting from KGB experiments with telepathy. As Dick’s journaling continued, his theories proliferated. He conceptualised his visions using ideas from Buddhism, Christian Gnosticism, philosophy, brain science and Jungian theory. He also entertained what he termed the ‘minimum hypothesis’: that it was all a symptom of mental illness. But how would one tell if that were the case?

At first glance, it might seem obvious that Dick’s religious episode was the expression of a troubled mind. The truth, however, is not so simple. For there is intriguing evidence that his visions can’t be chalked up to psychosis alone. To be sure, Dick had a history of paranoia caused by amphetamine abuse, but he had stopped using speed well before 1974. More importantly, his judgment seemed to improve during the episode. He took better care of his health and made clever business decisions. At the behest of his guiding spirit Thomas, Dick followed up on back royalties his publisher owed him and increased his income by several thousand dollars. In one incident, a hallucinated voice urged him to seek medical care for his infant son, for what turned out to be a hernia. Not only was Dick’s judgment better, but also, he was happier. He wrote that he felt more fulfilled and relaxed.

What can today’s mental-health professionals make of such incidents? Not much. Therapists aren’t typically taught to recognise benign spiritual experiences, nor trained to deal with patients who have them. By definition, mental illness means a diminution of functioning, not an expansion. A helpful illness cannot be considered an illness at all. While a handful of maverick therapists – C G Jung, R D Laing, Stanislav Grof, and a few others – have tried to make room for spiritual experiences in the mental-health field, their success has been limited.

To find out how to help patients confronted with the divine, we have to turn to spiritual teachings, such as the meditation literature. Visions are not uncommon for meditators, and guidelines from several traditions offer practical advice to those who experience them. The general rule is: stay grounded. Keep breathing, observe the experience, don’t take it literally, and don’t get too attached to it. For the fire often fizzles out: by 1976, Dick felt that ‘the divine spirit’ had left him. Devastated by the divine’s apparent withdrawal from his life, Dick overdosed on his blood pressure medication and slit his wrists. To make sure he would die, he then took a seat in his car with the garage door closed and the engine running. Luckily, he vomited his medication, the blood from his wrists coagulated, and the car engine stalled. He lived long enough to see one of his stories being made into the feature film Blade Runner (1982). But what he really wanted was to feel the divine fire again.

The Divine Madness of Philip K Dick (2016) by Kyle Arnold is out now through Oxford University Press.