"Time Bandits" is a marvelous cinematic tonic, a sumptuous new classic in the tradition of time-travel and fairy-tale adventure.

Opening today at area theaters, this witty offering of a young boy's fantasy experiences springs from Terry Gilliam, the transplanted American who became a member of the innovative British comedy troupe Monty Python. In his previous features -- "Monty Python and the Holy Grail," "Monty Python's Life of Brian" and "Jabberwocky" -- Gilliam seemed intent on running Python facetiousness ragged. .

The swell surprise of "Time Bandits" is that Gilliam has discovered a fantastic pretext that can accommodate giddy Python humor while opening up expansive possibilities for his extravagant scenery. His daft side and his fancy side approach a happy reconciliation in this surreal update of "Alice in Wonderland" by way of "The Wizard of Oz" and "Snow White and the Seven Dwarfs."

The story might even be subtitled "Kevin in Wonderland." The protagonist is a bright, adventure-seeking English kid, Kevin, charmingly embodied by 11-year-old Craig Warnock. He's sent to bed by his oblivious parents, who are preoccupied by their favorite TV game show, "Your Money or Your Life!" Suddenly, Kevin is confronted by a living, breathing manifestation of a storybook illustration. . Startled, he sits up in bed and stares as the noise increases and the cupboard vibrates violently.

All at once the door of the wardrobe bursts open, and a mounted knight charges out. He hurdles Kevin's bed and gallops away down a tree-lined avenue that has somehow materialized where a wall used to be. The vision ends as abruptly as it started when Kevin's father opens the bedroom door and demands that he stifle the racket and get to sleep.

The next night Kevin goes to bed prepared for adventure. Under the covers, he's dressed for travel, has a flashlight and satchel handy. He clutches an SX-70 camera, ready to document any supernatural weirdness with Polaroid snaps. He's in luck. This time a whole gang tumbles out of the agitated cupboard -- six scruffy, bickering, startled little men who resemble diminutive pirates.

They are, in fact, mutineers as well as buccaneers. Employed as gardeners by The Supreme Being, they provoked his displeasure by planting a gigantic, smelly monstrosity of a tree. Demoted, they struck back with a major crime, stealing the time map that identifies holes in the cosmos. Equipped with his confidential atlas, the mischievous runaways intend to pop in and out of various time frames, scooping up all the loot they can carry.

Randall, the leader of the delightfully scurvy crew, explains the situation to Kevin: "As a disciplinary measure we were sent down to the Repairs Department. You see, he'd just created evil and was having a bit of a problem with it. The fabric of the universe was sort of a botch-up job, to be quite frank . . . That's where this comes in: It's the map showing where the holes are, and it's the only one in existence. So why repair the holes? Why not use them to get stinking rich?"

A more or less willing captive, Kevin joins the bandits as they drop in and scamper out of time-traveling escapades. One narrow escape follows another. . An episode involving Napoleon (Ian Holm) gives way to encounters with Robin Hood (played by former Python luminary John Cleese as a kind of politely dim Royal Hand-Shaker), Agamemnon (played by Sean Connery as a hearty, sympathetic warrior-barbarian), Edwardian high society, a hypochondriac ogre and a towering giant.

The adventure culminates in a spectacular showdown between Really Powerful Fellows who seek the bandits and the missing time map. Satan, otherwise known as The Evil Genius (David Warner), lures the runaways to his craggy Gothic hideaway, a majestically sinister castle called the Fortress of Ultimate Darkness. There imperious, overconfident Evil matches powers with The Supreme Being, who finally enters in the slightly absent-minded, disarming presence of Ralph Richardson, modestly dressed in an ordinary, rumpled three-piece business suit.

One of the neater incidental jokes invented by Gilliam and co-writer Michael Palin (a fellow Python alumnus, he appears briefly as matched silly suitors, paying court to Shelley Duvall in different centuries) is the mention of a seventh dwarf bandit named Horseflesh. Evidently, Horseflesh masterminded the time map caper but cashed in his chips sometime before the surviving bandits met Kevin. Although Randall and his chums -- Wally, Strutter, Fidgit, Og and Vermin -- remain a daring, foxy and occasionally ferocious little band, the loss of Horseflesh seems to have cost some brainpower.

That's where Kevin comes in decisively, making the crucial intellectual and ethical difference at climactic points in the story. It's Kevin, the honorary Time Bandit and Seventh Dwarf, who suggests a means of escape when the heroes appear doomed, locked inside a cage suspended over an abyss in the Fortress of Darkness. It's also Kevin who urges the bandits to retrieve the time map from Evil after making good their escape, lest dreadful consequences ensue.

In short, Kevin emerges as a remarkably intelligent and gratifying juvenile hero, his braininess and fundamental decency calculated to flatter similar attributes in a juvenile audience.

Still, like all potent fairy-tale movies, "Time Bandits" is not innocuous entertainment. Gilliam's imagination is often at its most impressive when evoking eerie scenes. Unable to relish the campiness of demonic characters like the ogre or The Evil Genius or even the bandits themselves, the littlest kids may be simply terrified of them. Having seen the witch in "The Wizard of Oz" and the villainess in "The Rescuers" -- not to mention department-store Santas -- reduce tots to hyperventilating fright, I think it's reasonable to assume that the menaces in "Time Bandits" will be hard on the tenderest nervous systems.

Once kids reach the point where they can appreciate both the creepiness and the facetiousness, "Time Bandits" should prove a thought-provoking sensation.