You will not be surprised to hear that M. Night Shyamalan’s latest thriller, Split, concludes with a twist. What will likely stun—and hopefully excite—you, however, is the fact that the film’s shocker is a triumph that heralds the culmination of the writer/director’s comeback from nearly a decade spent traversing the wilds of studio-for-hire anonymity. For the first time since 1999’s The Sixth Sense, Shyamalan has managed to deliver a last-second whopper that’s as unexpected as it is satisfying. Rousingly redefining everything that’s come before it, Split’s finale reestablishes Shyamalan’s reputation as the king of out-of-left-field bombshells.

It would be disgraceful to even hint at the nature of that revelation, so unanticipated is its appearance. Yet it’s also impossible to properly assess Split without at least referring to it in general terms, as well as in the context of his career.

Largely on the basis of The Sixth Sense, the now-46-year-old filmmaker was once dubbed “The Next Spielberg” by Newsweek, and that hype—and the pressure to live up to it—drove Shyamalan, consciously or unconsciously, to repeatedly try to top his breakthrough’s legendary “I See Dead People” denouement, to ever-diminishing returns. By the time The Village debuted in 2004, audiences had caught on to the director’s bait-and-switch tactics—and grown weary of them. Following the twin disasters The Lady in the Water (in which Shyamalan posits himself as an artist-savior) and The Happening (a bit of unintentionally hilarious eco-horror), he’d come to seem like a guy weighed down by his own trademark style.

For anyone who appreciated his gifts for slow-burn storytelling and eerily methodical, chilly visuals (there remain few filmmakers as skilled at menacing cinematographic composition), Shyamalan’s fall from Hollywood grace was nothing to celebrate. No matter the brief flashes of aesthetic splendor in 2010’s children’s fantasy The Last Airbender or 2013’s much-maligned Will and Jaden Smith sci-fi adventure After Earth, there was something deeply depressing about witnessing a former prodigy, one who had the honest-to-goodness directorial goods, toiling away on impersonal big-budget projects that demanded, and thus received, none of his idiosyncratic flourishes. It was the rare instance of an auteur being stripped of his very auteur-ness—and it appeared, at the time, to signal the end of the road for the so-called heir to the Spielbergian throne.

But then, a startling thing happened: Shyamalan reemerged in 2015 with The Visit, a low-budget found-footage horror work (made with Paranormal Activity’s Blumhouse Productions) that, while boasting few of his visual signatures, cooked up some tasty mounting-dread suspense. Moreover, the film ended with an effective twist that came across as the natural culmination of all the bizarreness that had preceded it. It was a modest hit (earning a sturdy $65 million at the domestic box-office), in large part because it showed that, given some creative room to breathe, Shyamalan was still more than capable of expertly working over an audience’s nerves.

Split is a considerable leap forward from The Visit, a genuine return to form that finds the director wholeheartedly crafting the type of distinctive genre effort that initially defined him. Full of creeping-death pans down long corridors, and gorgeous panoramas in which figures are dwarfed by their environments—or key elements are shunted to the forefront/background corners of the frame—the film looks and feels like a Shyamalan movie. And it plays like one too, beginning in bizarre mystery and slowly unraveling to reveal, like The Sixth Sense, a world where trauma is capable of giving birth to otherworldly forces.

In the parking lot after a birthday party, Claire (Haley Lu Richardson) and her friends Marcia (Jessica Sula) and Casey (The Witch’s Anya Taylor-Joy)—the latter a troubled loner only invited out of obligation—are gassed and abducted by Kevin (James McAvoy). When they awaken, they realize they’re prisoners in a room with stone and drywall walls, a pristine-white bathroom, and a locked door that leads to a workroom and, alas, another locked door. Even more disturbing, though, is their captor—or should I say, captors, since Kevin, it turns out, is a severely unhinged man with 23 multiple personalities of varying ages, genders, and attitudes.

Through the girls’ interaction with Kevin, as well as via Kevin’s therapy sessions with his psychiatrist Dr. Karen Fletcher (Betty Buckley), we come to learn that there’s been a virtual coup in Kevin’s mind, and that he’s now become controlled by three of his numerous personalities: burly OCD-afflicted Dennis, cunning female Patricia, and innocent 9-year-old boy Hedwig. Oh yes, and this “trio” has chosen to kidnap Casey, Claire, and Marcia because they’re “pure,” and thus the ideal “sacred food” for The Beast, a forthcoming, monstrous 24th identity they believe will usher in a glorious new evolutionary age.

Split thus soon resembles a modern-day werewolf story, albeit one in which McAvoy—in a phenomenal scene-chewing performance that has him vacillating between masculine/feminine guises at the drop of a hat—is also akin to a steroidal Dr. Jekyll and Mr. Hyde (or Norman Bates). Still, with every winding development [minor spoilers follow], Shyamalan makes this material his own, including by casting his protagonists—McAvoy’s Kevin, and Taylor-Joy’s Casey, the latter of whom is seen in flashbacks suffering at the hands of her uncle (Brad William Henke)—as individuals similarly scarred by abuse. In their dynamic, Shyamalan crafts a portrait of the way violent mistreatment both damages and strengthens people. And as with The Sixth Sense and Signs, the director couches supernatural phenomena as a natural outgrowth of extreme, painful human experience.

The result is something like a sinister-revisionist take on multiple classic-horror staples filtered through Shyamalan’s fertile artistic mind. Manipulating our perspective and toying with our expectations to precise effect, Split takes thriller cinema’s fractured-psyche clichés and amplifies them to borderline-delirious effect, in the process twisting, turning and ultimately transforming itself into something at once familiar and novel. It’s bracing proof that the director hasn’t lost his knack for canny, incisive surprises. And, in its not-to-be-discussed-here closing moments, which drew audible gasps at a press screening I attended (including from yours truly), it’s also confirmation that some of Shyamalan’s old habits are so reliable, they need not be broken.