Lev Grossman is a nerd. He wants you to believe that it’s cool to read fantasy fiction. As Time magazine’s book critic, Grossman brings a nerd’s depth of arcane knowledge and obsessive confidence to this ambition. He draws on some of the tropes and conceits of the classics of the genre, from “The Chronicles of Narnia” to the Harry Potter story, melding them into a modern psychological novel to create something entirely new. The first volume, “The Magicians,” appeared in 2009, and this summer brings us “The Magician King,” which ends on an inkling for a third. Perhaps an entire Chronicles of the Magicians is forthcoming.

“The Magicians” is about a young boy named Quentin Coldwater who enrolls at Brakebills College, a secret school for magicians. With his friends, Quentin travels to Fillory, a Narnia-like kingdom that they all had known about through a series of children’s books. Not only does Fillory turn out to be real, but it is deadly as well. Quentin undergoes a long, dark passage of the soul and decides to abandon his childhood dreamland for a dissolute life as a young Manhattanite. But at the end of the first novel, his friends arrive outside his penthouse window and summon him back to the world of magic.

“The Magician King” picks up two years later. Quentin has rejoined his friends Eliot, Janet and Julia to become a quartet of kings and queens enjoying a peaceful life of privilege, presiding over their lands and people and magical creatures, when a sudden misfortune occurs that sets the plot in motion.

After some slow going at the start of the story, the plot widens to involve saving not only Fillory but magic itself. Salvation requires that Quentin and Julia quest for seven keys (although most of them are found, ironically, by others). Along the way, our heroes encounter underwater dragons (echoes of Ursula K. Le Guin’s “Earthsea”), sail to the edge of the world and visit a depressing underworld.

Juxtaposed with these sword ’n’ sorcery doings is the story of his high school crush, Julia, and how she became a queen of Fillory. After failing the exam at Brakebills, she becomes obsessed with magic and learns it on the street in a series of hedge schools where would-be witches trade secrets. Eventually, she acquires skills that rival Quentin’s classic education, and she joins a select group of magicians in the south of France looking for the sacred mysteries behind it all. What they unleash upon themselves is truly sadistic.

“The Magician King” is a dark and disturbing book on many levels. Some readers will be taken aback by its theological undercurrents, the mythos beneath its logos. The gods are at work in strange ways, vindictive and destructive. At one point, the characters spy one working on the interior plumbing of the Neitherlands — the space between worlds — like a gigantic “silvery janitor.” Here the book most clearly privileges technology over faith. Behind the curtain is no wizard, merely a machine.

It also breaks down elements usually celebrated in fantasy novels. Grossman’s worlds are relentlessly recursive, like an Escher drawing, and in fact, one of the texts he plays with is Douglas Hofstadter’s “Godel, Escher, Bach: An Eternal Golden Braid,” a kind of secret nerd bible. What other fantasy would dare to expose its own clockwork? At one point, the characters realize that their journey has been along a kind of Mobius strip that lands them in front of an existential nothingness. “Full circle. They were back where they started. There was a deep click that seemed to echo forever, the sound bouncing off the outer walls of the world, a bank vault opening in a cathedral.”

A spirit of disenchantment pervades this fantasy. The kings and queens of Fillory are polymaths, self-taught geniuses capable of incorporating dozens of foreign languages into their spells. They possess the secrets of magic and live in a storybook forest with talking sloths and Seeing Hares. They have been through a series of adventures that would sober any soul (Quentin’s hair has gone snow white), and yet, they remain petty, selfish and profane. They often sound like sailors or the Sopranos rather than prep-school elites.

Grossman’s third-person narration closely echoes the inner lives of his characters, but after a while, the constant swearing empties the language as readily as a cliche. The style comes across as fronting, trying to be cool, but that point has already been made elsewhere and better.

Quentin is no Harry Potter. The other humans in Fillory are not the Pevensie children. This isn’t a book for the kids. It’s not your father’s Narnia or your older sister’s Hogwarts. Something sadder and more sinister has entered this fantasy: the modern world.

Donohue’s most recent novel is “Centuries of June.”