(Random House)

According to Salman Rushdie’s new novel, most of what we know about genies is wrong, which makes me worry that I may have spent too much time watching Barbara Eden. The harem pants, the wish-granting, that eager “master” talk — turns out, it’s all pure fantasy. “It was extremely unwise to believe that such potent, slippery beings could have masters,” Rushdie writes. And we’re not even using the right term. “The name of the immense force that had entered the world was jinn.”

Those fiery, smokeless creatures soar around every page of Sir Salman’s “Two Years Eight Months and Twenty-Eight Nights,” and if that title sounds like a chore, make your jinni do the math. You’ll get a thousand and one nights, which is this novel’s fantastical inspiration. In these nested, swirling tales, Rushdie conjures up a whole universe of jinn slithering across time and space, meddling in human affairs and copulating like they’ve just been released from 20 years in a lamp.

But, please, it’s not all flying carpets and navel rubies. This is a mock-heroic work of history — or at least cultural anthropology — constructed by scholarly narrators sometime near the end of the third millennium, long after humanity has finally settled into peaceful rationality. Stitching together fragmented records, legends and myths, these scholars tell the story of the War of the Worlds, that hinge moment (right about now) when the fabric separating our realm from the jinn realm tore, and the strangeness swept in.

The people of Earth first experience this rift as a cataclysmic storm, not so rare in these latter days of global warming. Soon everyone notices that “the world had become absurd, and that the laws which had long been accepted as the governing principles of reality had collapsed.” Moving around New York, our narrators concentrate on a few ordinary folks electrified into a greatness that they cannot possibly comprehend.

There’s a touch of the author Isaac Bashevis Singer in these bizarre incidents. The trophy wife of a philandering financier shoots lightning bolts from her fingertips. A graphic novelist finds his most outrageous superhero come to life in his bedroom. A foundling baby causes anyone dishonest in her presence to start rotting. And most important to the record of humanity’s triumph is a lonely gardener who wakes up one morning and notices that he’s walking a fraction of an inch above the ground.

Rationalist lineage

How we arrived at this peculiar moment and how we (just barely) survived is the impish story that Rushdie unfurls as he darts around like Robin Williams till he’s blue in the face. And how all this zaniness can convey such a thoughtful analysis of religious fanaticism is part of the novel’s spell. (An excerpt appeared in the New Yorker earlier this year.)

The enchantment begins in Arab Spain with the unlikely marriage of the 12th-century philosopher Ibn Rushd, who was a real person, and the horny jinnia princess Dunia, who, so far as we know, was not. While she gives birth to innumerable human-jinn children, Rushd, an Aristotelian rationalist, devotes his life to disputing the claims of the Muslim theologian Ghazali, a pillar of orthodox Islam who preached a fearful doctrine of divine supremacy.

In the 21st century, their 800-year-old argument breaks out again, pitting the jinn minions of Ghazali against the descendants of Rushd and Dunia.

Could there be some relationship between the rationalist philosopher Rushd and the modern-day novelist Rushdie?

Was Larry Hagman the luckiest man in the world?

According to the author’s memoir, Salman’s father changed the family name to Rushdie “because he respected Ibn Rushd for being at the forefront of the rationalist argument against Islamic literalism in his time.” In 1989, when Ayatollah Khomeini condemned “The Satanic Verses” and called for the novelist’s assassination, Rushdie told himself, “At least I’m going into this battle bearing the right name.”

As terrifying as that ordeal undoubtedly was, Rushdie has now elaborately mythologized it by the light of Aladdin’s lamp, recasting the tension between superstition and reason as a series of magical tales. He never calls anybody out by name, but it won’t take a jinni to tell you who belongs to that “murderous gang of ignoramuses” who devote themselves to “the art of forbidding things,” such as “painting, sculpture, music, theater, film, journalism, hashish, voting, elections, individualism, disagreement, pleasure, happiness, pool tables, clean-shaven chins (on men), women’s faces, women’s bodies, women’s education, women’s sports, women’s rights.” His most acerbic judgments are delivered in the cool academic tones of his futuristic narrators: “The practice of extreme violence, known by the catch-all and often inexact term terrorism, was always of particular attraction to male individuals who were either virgins or unable to find sexual partners.” Take that, Islamic State.

Silk scarves of comedy

“Two Years Eight Months and Twenty-Eight Nights” translates the bloody upheavals of our last few decades into the comic-book antics of warring jinn wielding bolts of fire, mystical transmutations and rhyming battle spells. Sometimes that treatment cuts awfully close for humor, as when Ghazali’s murderous jinni engulfs a skyscraper in New York: “One distraught or possibly drug-addled and certainly bespectacled office worker was seen leaping from a window on the sixty-seventh floor.” Too soon. But usually, Rushdie’s allusions are more philosophical than historical, and his critique of Islamofascism — really, religious fanaticism in all its colors — is draped in silk scarves of comedy. He’s as likely to mention Mickey Mouse as Schopenhauer while he describes this convulsive period when civilized people began to emerge from philosophical adolescence and cast off their faith in God.

Of course, there’s something ironic about enlisting jinn in a battle against humanity’s belief in the supernatural. But that irony levitates the novel above what could have been a shrill parable about the evils of religion. As confident as these narrators (and Rushdie) are in the superiority of reason, they ultimately admit that something tangential to faith, something stirring and essential, was lost in the triumph of science and logic. Writing some 500 years after God evaporated from the human mind, they confess, “Fewer and fewer of us, in each successive generation, retained the ability to dream, until now we find ourselves in a time when dreams are things we would dream of, if we could only dream. We read of you in ancient books, O dreams, but the dream factories are closed. This is the price we pay for peace, prosperity, tolerance, understanding, wisdom, goodness, and truth: that the wildness in us, which sleep unleashed, has been tamed.”

In other words, watch what you wish for.

Ron Charles is the editor of Book World. Follow him on Twitter at @RonCharles.

On Sept. 19, Salman Rushdie will be at 6th & I Historic Synagogue, 600 I St. NW, Washington, D.C. For tickets, call Politics & Prose Bookstore at (202) 364-1919.

Two Years Eight Months and Twenty-Eight Nights

By Salman Rushdie

Random House. 290 pp. $28