Fifteen years ago, when Marlon James was working on his first novel, he requested an exorcism. He was in his early thirties, living in Kingston, Jamaica, working as a graphic designer and occasionally producing photo shoots for music magazines. He had attended Sunday school as a child, with his brothers, in the nearby town of Portmore, where his family lived in a neighborhood populated by doctors and civil servants. His parents worked in the police force. His mother, a sweet and stubborn woman, rose to the rank of inspector; his father, a brash but melancholy man, left the force and became a lawyer. Both were readers: his father favored Shakespeare, and his mother loved O. Henry. When James was five, other kids started calling him a sissy, and he retreated into comics and books. He liked Greek mythology because everyone in it seemed to be naked. After reading “Little House in the Big Woods,” he decided that he wanted to write. He wrote plays—one was a Jamaican revision of “Cinderella”—and he drew comics, with shape-shifting monkey men and telepathic heroes. After reading “Tom Jones,” at age twelve or thirteen, he filled a notebook that belonged to his father with diary entries in the style of Henry Fielding.

At Wolmer’s Trust High School for Boys, classmates called him Mary, and he kept a distance from his more popular older brother, to spare him embarrassment. He became friends with a girl named Ingrid, who attended Wolmer’s Trust High School for Girls, and who, like him, believed that Jamaica was too small. They talked about the new-wave and American pop records they heard on FAME FM, and together they made a sardonic and punchy zine called Rum. James began locking himself in his bedroom and tape-recording his efforts to sound masculine, repeating words like “bredren” and “boss.” Sex between men is illegal in Jamaica—the law is unenforced now but remains widely supported. Shortly before James’s eighteenth birthday, Hurricane Gilbert flattened Jamaica, leaving the island without power for months. One night, on a battery-powered radio, he heard “Sweet Child O’ Mine,” by Guns N’ Roses, for the first time. The bridge made him sob. Where do we go now? he thought, and kept thinking it for years.

At the University of the West Indies, James fell in with an arty crowd who liked college rock and hip-hop as much as he did and didn’t ask why he never dated. After graduating, he got a job as a copywriter for a Kingston ad agency. He and Ingrid made regular trips to Miami to go clubbing, and on one of those trips he went to an adult video store and bought a VHS tape called “Dreams Bi-Night.” He returned to the store on subsequent Miami visits, buying gay porn magazines and poring over them for hours, then leaving them in a hotel trash can before he flew home.

He started going to church again after another close friend, a pastor, suggested that the answer he was looking for could be found in Jesus. They said a prayer of invitation together and James considered himself born again. He joined a charismatic evangelical church in Kingston, with a mostly upscale congregation, where people spoke in tongues and services lasted for hours. James attended worship on Sundays, went to Bible study on Mondays and Wednesdays, planned church events on Thursdays, helped out with a youth group on Fridays. He did graphic-design work for the church in his spare time. He sent away for guidance about what the church discreetly termed his “struggles.” A pamphlet came in the mail, titled “Are You Gay? No Way!” It advised him to think of all the men he wanted to sleep with, and then to think of all the men he wanted to be. It was the same list, wasn’t it? Relieved, James decided that he was straight; he just had a hero-worship problem.

But he felt restless, and frustrated by the church’s anti-intellectualism. He began sneaking novels inside a leather Bible case to read during worship. One of them, Salman Rushdie’s “Shame,” an extravagant tall tale set in “not quite Pakistan” and laced with first-person authorial intrusions, rearranged his ideas about what writing could be. He wrote a scrap of an African fantasy story, set in a world ruled by eight evil spirits. Then he began writing a novel about two mysterious preachers battling for control of a fictitious Jamaican village, Gibbeah, in the nineteen-fifties. They are driven by sexual secrets, and Gibbeah is obscurely cursed: dead cows with upside-down heads wash up in the river, and the sky drips with black feathers and blood.

He titled the novel “John Crow’s Devil” and mailed it to agents and to publishers. It was rejected seventy-eight times. He told friends to delete the copies that he’d e-mailed to them, and ceremonially burned the manuscript on the balcony of his apartment. But, in 2004, he took an old copy of the first chapter to a workshop held by Calabash, a literary festival on the south coast of Jamaica that had been founded just a few years before. The workshop was taught that year by the writer Kaylie Jones, whose novel “A Soldier’s Daughter Never Cries” had been adapted by Merchant Ivory Productions. She found the chapter astonishingly assured, and asked to see the rest of the book. James located a copy of the complete manuscript in his e-mail outbox. Jones read it, and offered to edit it free of charge.

At church, James was still stuck in a cycle of temptation, transgression, confession, and redemption. He had seen other congregants receive exorcisms, and he decided that he needed one, too. The pastor called a church across town, aiming for discretion. James went there on a Tuesday morning. A man and a woman were waiting for him, in a room that was empty except for a chair and two plastic bags. He sat down and told them about his compulsive use of pornography. He didn’t say anything about being attracted to men. He confessed that he loved but didn’t like his father, who’d had four children with other women and had moved to Antigua, where he became a prosecutor. The woman asked James about his mother, and he started to bawl. He said that he doubted whether the Gospel could help him: he couldn’t accept a faith that preached joy in the morning and bullshit at night, he said. The deliverers recited Bible verses and rejected James’s lies in the name of Jesus. James, traumatized, began to vomit, eventually filling both plastic bags. Finally, he shouted, “I see two men fucking every time I close my eyes to pray.”

The deliverers cast the spirit of homosexuality out of him, and the spirit of blasphemy, and the spirit of disbelief. They told him that they heard eight demons inside him; he had the delirious thought that they were hearing the spirits that he had invented for his African fantasy story. After a while, he stopped crying, and he ordered his demons to leave. The woman held his face in her hands and told him he was free. For several months, there were no struggles. Then he turned to the pornography again. This time, he didn’t feel guilty afterward. He didn’t feel that he needed to be redeemed by Jesus. The exorcism had worked, he realized—it had just got rid of the wrong thing.