Over the past four decades, Alan Moore has earned a reputation — and a massive, worldwide audience — as a historian and champion of the macabre. In his legendary comics “V for Vendetta,” “Watchmen” and “From Hell,” the natural and the supernatural can be difficult to distinguish. Now, he’s published a new novel, “Jerusalem,” which is epic in scope and phantasmagoric to its briny core. It takes place over 1,000 years in the English town of Northampton, also known here as the Boroughs. It’s a hardscrabble realm teeming with painters and prostitutes, would-be poets and biblical demons. The angels play snooker with the eternal souls of the residents on the line.

“Jerusalem” revels in the idea of eternalism, the theory that past, present and future exist all at once. Everything that has ever happened in Northampton is still happening. Everything that eventually will happen there is already happening now. Amid that chronological and ontological maelstrom, Moore’s characters must reckon with the occasional slippage between their town and a shadowy parallel realm known as Mansoul. From Mansoul, the deceased can watch all of the goings-on in the town.

Moore has divided Jerusalem into three main sections, and each could stand alone as a novel unto itself, yet together they form something extraordinary. The multi-generational story involves dozens of people, but in some regards Moore’s home town of Northampton itself serves as his primary muse and as a character in its own right. “Jerusalem” celebrates its “long tradition as a haven for religious firebrands, insurrectionists and the plain old mad.”

[7 graphic novels and memoirs you should read this summer]

The novel doesn’t have a through-line plot arc any more than do Hieronymus Bosch’s hell­scapes. But we learn a great deal about the Vernal and Warren families. The artist Alma Warren and her brother Michael come across as the most realized of the ensemble. After suffering a chemical accident at work and then knocking himself unconscious, Michael begins to lose his grip on reality. Alma creates a series of mixed-media artworks inspired by his visions and prepares what will be an incendiary exhibition. Recurring themes include the sordid marriage of madness and art, the often unseen presence of practical magic in everyday life, and the ways in which history can glue together a family and a community. It takes a village to produce a village idiot.

The local asylum is full of people in similar circumstances as Michael, their fleeting glimpses of Mansoul continuing to haunt them. That nether world is closer than is immediately obvious. “Michael felt like he was floating in a rubber ring, just underneath the smoky yellow ceiling of the living room. He wasn’t certain how he’d got there and he didn’t know if he should be alarmed about the ­corner-fairy who was waving to him from the shady recesses only a few feet above.”

In Mansoul, language breaks down and then gets more or less put back together again, as Moore illustrates most acutely in a virtuosic chapter that pays homage to — and parodies — the gobbledygook of “Finnegans Wake”-era James Joyce. Moore’s own prose is always lively and rarely orthodox. He can evoke mirth and dread in equal measure. His similes want to leap from their pages. A lackluster intimate encounter ends “like an old tea towel that had been wrung out time after time until the pattern on it disappeared.” An approaching storm looked “like darkened pearls that seethed and boiled and were become a changing and fantastic swim of wrinkles.” One character thinks of a woman’s posterior as “two wrestlers full of muscles in a crush, each one in turn gaining an inch on their opponent who immediately takes it back, deadlocked so that they merely seem to heave from side by side.”

The prose sparkles at every turn, but that’s not to say it’s without flaws. Some entire chapters, particularly in the middle Mansoul section, struck me as wholly soporific. Moore also demonstrates an affinity for overwriting. I was hard-pressed to find many nouns that did not arrive man­splained with an unnecessary adjective. Here’s a typical sentence: “The big square bathroom with its plaster-rounded corners is a blunted cube of grey steam rising from the eight-foot chasm of the filling tub, an ostentatious lifeboat made from the tide-lined fibreglass.” Perhaps because he’s accustomed to communicating visually, Moore sometimes forgets that when it comes to language, less is often more. That said, the humor and wisdom and the sympathies we feel for his characters make it easy to absolve these transgressions.

Author Alan Moore

The period vocabularies contribute to the rare sense of immersion, as does the sheer size of the book — almost 1,300 pages. In preparation for a long train ride, I had to take a razor knife to the spine of my copy to vivisect away the portion I’d already read so I could fit the remainder in my backpack. Fortunately, the story weighs as heavily on the mind as in the hands. “Jerusalem” is a novel of ideas about the conjunction of time and place. It’s a difficult book in all the right ways in that it brilliantly challenges us to confront what we think and know about the very fabric of existence.

That maximalist, kitchen-sink approach accounts for many of its pleasures. There are unexpected twists and frequent hairpin changes in mood. What makes it truly shine, however, is its insistence that our workaday world might not be quite as mundane as we think. Lurking in the corners of the ceiling, we might just find a portal to a different realm. The imagination Moore displays here and the countless joys and surprises he evokes make “Jerusalem” a massive literary achievement for our time — and maybe for all times simultaneously.

Andrew Ervin is the author of the novel “Burning Down George Orwell’s House.” His nonfiction book “Bit by Bit: How Video Games Transformed Our World” will be published next year.