In 1998, Bill O’Reilly published his first and, so far, only novel: “Those Who Trespass: A Novel of Television and Murder.” The main character is a violently bitter journalist named Shannon Michaels, who, after being pushed out of two high-profile positions, takes revenge on four of his former colleagues by murdering them one by one.

On Wednesday, shortly after O’Reilly was ousted at Fox News, the apparent result of a mounting protest against his long record of alleged workplace sexual harassment—and, more to the point, the financial damage that this protest was doing to the network—I picked up a copy of “Those Who Trespass” and read it straight through. The novel, peppered with rants about ex-wives, newsroom politics, and the Long Island Expressway, is an astonishing read for many reasons, including O’Reilly’s credible ability to write in free indirect discourse. Another is the unchecked lust for revenge and violence that permeates the novel. And there is the fact that a veteran newsman preys upon a younger female co-worker in the very first scene.

The second sentence of “Those Who Trespass” describes Ron Costello, a correspondent for Global News Network, on assignment in Martha’s Vineyard and struggling with a “basic human need, the need for some kind of physical release.” Costello spots a pretty camerawoman at a party, happily notes that she’s had too much vodka, and approaches her with “intense sexual hunger.” Costello is “universally loathed” at his network, O’Reilly writes, but Costello doesn’t mind: “His energy was directed toward getting as much as he could of what he wanted. And tonight he wanted this freelance GNN camerawoman named Suzanne. He wanted her in a big way.” When Suzanne rejects Costello, he’s furious. (“Goddamn bitch. She’ll be sorry,” he thinks.) Then the vengeful Michaels kills Costello by shoving a silver spoon through the roof of his mouth and into his brain.

As Nicholas Lemann noted in a piece about O’Reilly, from 2006, for this magazine, the feud between Michaels and Costello in “Those Who Trespass” is based on O’Reilly’s experience at CBS, in the eighties, during the Falkland Islands War. O’Reilly and his crew had captured exclusive footage of a riot in Buenos Aires, which CBS spliced into a report delivered by the veteran network correspondent Bob Schieffer, who never mentioned O’Reilly by name. In the novel, this is exactly what happens to Michaels, who, while still in Argentina, confronts Costello and assaults him in front of their co-workers. He is blacklisted from the network, and spends the next decade plotting his revenge.

Michaels is, as Lemann puts it, a “possibly once good man driven mad by broadcast journalism.” He serves as O’Reilly’s first avatar within the novel: a horny, aggressive, ambitious Irish-American who delivers monologue after monologue about the “self-obsessed business” of television news. (“People who are greedy for power realize that television is the most influential tool ever created,” he says.) O’Reilly’s second avatar is a New York City homicide detective named Tommy O’Malley, who is also horny, aggressive, ambitious, and Irish. O’Malley is an “intense man, sometimes quick to anger.” He arrests a drug dealer and breaks his thumb out of spite: “That must really hurt, he thought, giving in to a feel of sadistic pleasure.” He really hates inner-city teen-agers. (“These thugs killed with a casualness that O’Malley could not comprehend.”) For the duration of the story, as Michaels goes about murdering colleagues who have slighted him, O’Malley, the good guy, is hot on his trail.

Both men are, in the meantime, hot on the trail of Ashley Van Buren, a thirty-one-year-old reporter tracking the murders for the New York Globe. Like both Michaels and O’Malley, Van Buren is horny, aggressive, and ambitious. Unlike them, she’s not an avatar for O’Reilly but an object onto which he projects a whole host of suspect qualities. “Ashley Van Buren knew her good looks were partially responsible for her rapid rise,” O’Reilly writes. “She had the face, though not the body, of a fashion model. . . . Just 5’2”, she had a rather large bust that both helped and hurt her depending on the situation.” In her first conversation with O’Malley, trying to get information about the murder on Martha’s Vineyard, the blond Van Buren deploys both a “deep, sexy tone” and a “teasing voice.”

Van Buren is the only major female character in the novel. (An “unattractive woman” named Hillary appears briefly, before Michaels knocks her out and throws her body out the window into an alley.) It’s almost funny how utterly the character of Van Buren unmasks her author: she is conveniently and perpetually sexually frustrated, and she is happy to be seen as an object of desire while she’s at work. She’s dying for a real man to make real advances upon her. In one entirely unnecessary flashback, she invites a date to her apartment, takes off her bra, licks her lips at the sight of her reflection—“her unrestrained breasts were full and firm . . . and her nipples were clearly outlined”—and then pouts when her date won’t take the hint. Over the course of the investigation, she becomes attracted to both O’Malley and Michaels; when she sleeps with Michaels, she silently marvels at “Shannon’s stamina.”

On the whole, “Those Who Trespass” is a not a bad potboiler: a love triangle between a detective, a killer, and a journalist; a cat-and-mouse game through a series of four murders, culminating in a large explosion. There are some legitimately, if perhaps unintentionally, comical moments: at one point, O’Malley arrests a teen-ager in a gang called the Bitchin’ Boys. But the book is a nauseating read because you know, while reading it, that it was written by Bill O’Reilly. It feels transparently personal—in the acknowledgments, O’Reilly says that writing the book was a “harrowing experience”—and it’s full of recognizable pet ideas. Housing projects are “moral sinkholes”; inner-city children are “unfeeling predators.” A Latino detective succeeds in his department because “his strategy included overlooking petty crap like prejudice.”

In the immediate aftermath of O’Reilly’s exit from Fox News, it’s impossible not to think about how President Trump defended him earlier this month, telling the Times, “I don’t think Bill did anything wrong.” It’s impossible to take in the steady stream of coldly rendered violence in O’Reilly’s novel without remembering his daughter’s court testimony that he choked his ex-wife and dragged her down the stairs by the neck. Two sex scenes in “Those Who Trespass”—one between Van Buren and Michaels, another between Van Buren and O’Malley—strongly echo the fantasy O’Reilly described to the producer Andrea Mackris, which she detailed in her 2004 lawsuit against him. If the accusations against O’Reilly are true, then writing a female-journalist character who’s dying to be felt up and propositioned doesn’t seem to have served as any sort of a release valve for O’Reilly’s pent-up sexual aggression; he apparently took that fantasy with him to the workplace, to the extreme detriment of the women around him, for many years.

In one scene from the novel, a psychologist surmises that Michaels’s career was the source of “his feelings of omnipotence and grandiosity.” He continues, “Because Michaels was a success on television, it reinforced his opinion that he was a very special human being. He got the attention he craved, the admiration of thousands. Being on TV was like a drug to him and when it was taken away from him, he had to find a substitute drug.” Later on, Michaels explains to Van Buren, “If you’re paid the big bucks, then you have to carry the ratings. So not only do you have the pressure to perform flawlessly, but you also have to worry about how many people are watching. That kind of pressure makes people crazy.” Van Buren asks Michaels why the TV business attracts so many bad people, and he answers, “The same reason politics does. Power.”