GOOD OLD ROMAN POLANSKI--who else would make The Ninth Gate, a movie about the quest for a book illustrated by Satan ... and end it by having the movie come out in favor of finding the book and reading it? In the last decade, Polanski has been a sporadic filmmaker, but he could be forgiven for his lack of interest--he's made two minor classics and no one saw them. These were his dead serious Death and the Maiden (1994), featuring a typically brilliant performance by Sigourney Weaver, and Bitter Moon (1992), the ultimate parody of the swanky erotic adult psychological thriller, starring Polanski's consort, Emmanuelle Seigner. Compared to these two overlooked gems, The Ninth Gate is a minor, overlong piece of work. And yet it has its pleasures.

Johnny Depp plays a bewhiskered contempo-beatnik book dealer named Dean Corso (why not Gregory Moriarity?), who has been hired by the millionaire bibliophile Boris Balkan, Ph.D. (Gore Vidal look-alike Frank Langella). Balkan is searching for three copies of The Nine Gates of the Kingdom of Shadows, a book published in 1666. Heading to Portugal and Paris, Corso searches for the forbidden book in private libraries while sinister assassins try to rub him out. Throughout, Corso treats rare books cavalierly, smoking an omnipresent cig and spilling ashes as he flips back to the illustrations, which look like the drawings on a deck of Tarot cards. The ones who know the most about the book are women: Baroness Kessler (the British stage actress Barbara Jefford), your standard cryptic German noblewoman in a wheelchair; a wealthy, vengeful widow (Lena Olin); and a mystery woman billed as "The Girl" (Seigner, looking like a high-IQ version of Nastassja Kinski).

It takes Corso the whole movie to figure out that he ought to photocopy the forbidden book for easier portability. Such points will bother rationalist viewers for whom such set pieces as the annual meeting of the Order of the Silver Serpent will be plain silliness. The order's rally looks amusingly like the Black Mass orgy in Eyes Wide Shut, only framed for parody--and yet there's a scariness to the long slow shot of the order's chateau, illuminated with torches under an ultramarine full-moon sky.

The Ninth Gate has an authentic Gothic chill to it. You rarely laugh at it--and often with it. While never taking the Transylvanian tropes of The Ninth Gate too seriously, Polanski doesn't debunk them. The director of Rosemary's Baby knows how to be amused and fearless when dealing with the occult. Yet he's also an expert in telling this story in a way that makes it shuddery as well as funny, all without gore or much in the way of digital effects. The Ninth Gate isn't in the league of Rosemary's Baby, but Polanski deserves credit for an ending that seems to be a switch on the motto of Frankenstein. Not "There are some doors that man must not enter" but "as long as man is there, he might as well rattle the doorknob to see if it's been left unlocked."

The Ninth Gate (R; 127 min.), directed by Roman Polanski, written by Polanski, John Brownjohn, Enrique Urbizu, based on the novel The Club Dumas by Arturo Perez-Reverte, photographed by Darius Khondji and starring Johnny Depp, Lena Olin and Frank Langella, opens Friday.