The central character in Rabih Alameddine's smart, impassioned and uneven new novel calls himself "the congenital immigrant." Jacob is in his 50s, and over the years he's made his way from Yemen to Egypt to Lebanon to Sweden to San Francisco. In childhood, he watched his penniless mother turn to prostitution. During his teens, he was sexually abused by a nun. As an adult, Jacob has lost a lover and several friends to AIDS. "I left parts of me everywhere," he says.

The primary action in "The Angel of History" occurs in flashbacks. Waiting to see a doctor at a psychiatric clinic, Jacob reflects on his traumatic youth, his life as a gay Arab in the United States and his battles with mental illness (he's been hearing voices, Satan's among them). These chapters are evocative and unpredictable. Just when you're expecting sentimentality, Jacob hits you with a bolt of bracing R-rated humor. He's especially good at dreaming up filthy riffs based on beloved poetry; you'll never think of Dylan Thomas' verse quite the same way.

His irreverence is a way of coping with loss. Beginning in the 1980s, he says, "I had six friends die in a six-month period, half a dozen of my close friends including my partner." As a result, he loathes mainstream attempts to co-opt the suffering engendered by the AIDS crisis. "It's a good thing he didn't tell me he watched 'Philadelphia,' " Jacob says of a condescending acquaintance, "or I would've stabbed him with a butter knife."

Increasingly isolated in a post-9/11 world, Jacob has been "looking at online videos of home … drone strikes in Yemen, car bombs in Lebanon … beatings and non-coups in Egypt, chemical weapons in Syria. Images of children dying of sarin gas flicker on the screen, mouths trying to capture air for lungs used to breathing." Thousands of miles away, he can only weep for those he hasn't seen in decades. "Something had shifted within," he says, "the wall that defended my heart had crumbled."

Alameddine is the author of the splendid "An Unnecessary Woman," a National Book Award finalist, and his prose can be enormously powerful. But "The Angel of History," for all its intelligence and immediacy, can also be frustrating. Jacob, we learn, is an aspiring writer, and so we're treated to some of his works-in-progress. One of his short stories is told from the perspective of a military drone; intended as a critique of U.S. foreign policy, it's a heavy-handed mess that only interferes with the novel's momentum.

A bigger flaw stems from Alameddine's decision to include a series of chapters in which Satan and Death discuss Jacob's plight. There's nothing inherently wrong with this idea. From Dante to Milton to Goethe to Monty Python, there's a rich tradition of fictional works that reserve prominent roles for demons, devils and sundry lords of the underworld. But Alameddine's effort is disappointing: Satan speaks in run-on sentences, and Death, who should be the go-to guy for gallows humor, isn't even moderately funny.

At times like these, Alamed­dine's novel reads like a script for a stilted stage play. The good news is that the narrative dead-ends are clearly labeled ("Satan's Interviews" and "Jacob's Stories") and take up no more than a third of the page count. The rest of "The Angel of History" is Alameddine at his best, or very close to it. Even allowing for his obvious missteps, he's becoming an indispensable writer.

Kevin Canfield is a writer and critic in New York City.

The Angel of History
By: Rabih Alameddine.
Publisher: Grove Atlantic, 294 pages, $26.