Steven Spielberg's career as a director has been one of almost profligate variety: from mechanical sharks to the Normandy invasion, from Indiana Jones to the Warsaw ghetto, not to mention the slave ships, the angry dinosaurs and the second worst Pearl Harbor movie ever made. But every so often he comes back to the figure of a lonely boy facing the incomprehension and cruelty of the adult world, and when he does -- most notably in ''E.T.'' and ''Empire of the Sun'' -- it is with a feeling of coming home to emotions that lie beyond the reach of the ruthless sentimentality that has been his greatest weakness.
The vulnerability of children is of course a subject that invites maudlin excess. But Mr. Spielberg's needy lost boys dwell in a psychological limbo that elicits not only pity and protectiveness but also recognition. There is something irreducibly real about the sensitivity and curiosity of Eliot in ''E.T.'' and young Jim in ''Empire,'' and also about the primal resentment that troubles their smooth, eager faces. A central and nearly universal experience of childhood is to feel abandoned and betrayed by one's parents. The need to compensate for this loss is what forces us to grow up and what sends our fairy-tale alter egos off on their adventures.
''A.I.'' is the best fairy tale -- the most disturbing, complex and intellectually challenging boy's adventure story -- Mr. Spielberg has made. Once again he asks us to identify with a young boy, exiled from the only home he knows and forced to find his way in a strange and unsympathetic world. Our bond with David (Haley Joel Osment) is complicated, however: he is not real at all but a sentient robot designed by a company called Cybertronics for the comfort and convenience of childless adults.
At the beginning, as an image of the ocean (a symbol of maternity) fills the screen, the soothing voice of Ben Kingsley explains that an ecological catastrophe has left many of the earth's great cities underwater and that in the midst of widespread famine some places (like New Jersey, where the movie takes place) have sustained material prosperity by placing heavy restrictions on childbearing. David is the brainchild of a scientist named Allen Hobby (William Hurt), who theorizes that robots, once programmed with the capacity to love, will begin to develop an ''inner life of metaphor and dreams'' that will represent a qualitative advance beyond the outwardly lifelike robots called mechas that circulate among their human counterparts performing various services.
The wider dimensions of this future world become clear only later. The first third of ''A.I.,'' once some necessary exposition has been taken care of, introduces David into the home of Henry and Monica Swinton (Sam Robards and Frances O'Connor), whose only son, Martin (Jake Thomas), lies frozen and comatose in a hospital ward decorated with scenes from classic children's stories. At first Monica is repelled by David. Mr. Osment uses his wide blue eyes and ingratiating smile to suggest the uncanny creepiness of a living doll, and the film plays cleverly with the monstrous implications of its conceit. The fantasy that humans' replicas of themselves will come to life is more often than not -- in the medieval legend of the golem, in Mary Shelley's ''Frankenstein'' and in countless horror films -- a source of terror and anxiety. Fear is the underside of enchantment, and the spell of wonder ''A.I.'' casts is tinged with dread.
The mood of disquiet only deepens when Monica activates David's imprinting function, in effect flipping the one-way switch that will make him love her unconditionally and eternally. His absolute and unwavering adoration -- the way Mr. Osment utters the word mommy is both heart-rending and chilling -- demands reciprocation.
Real children, it turns out, are more difficult to love. Martin, when he returns home, is sneaky and disobedient, sarcastic and manipulative. He urges Monica to read ''Pinocchio'' aloud at bedtime. ''David will love it,'' he says with a knowing smirk. That Carlo Collodi story of a wooden puppet who turns into a real boy becomes a kind of scripture for David, and a rich source of images and allusions for ''A.I.'' (The version of the story most familiar to movie audiences, the Disney animated feature, seems not to have survived the great flood. This dream of the future has been brought to you, after all, by Warner Brothers and DreamWorks, whose crescent-moon logo appears to decorate the bed where David and Martin sleep.)
Our startled discovery that we may prefer David to his quasi-brother -- he's perfect, after all -- is an indication of how tangled and ambiguous the movie's themes are. If we fall for David, and if, later, we side with his mechanical brethren against their human oppressors, are we affirming our humanity or have we been irrevocably alienated from it?
Tangled and ambiguous are not words one normally associates with Mr. Spielberg, who often pleases audiences by inviting them to be pleased with themselves. He tells you how to feel, and while you are usually powerless to resist his manipulations, you can always object to his moral bossiness.
But the experience of ''A.I.'' is different. The project was originally conceived by Stanley Kubrick, to whom the film is dedicated. Moments of homage are scattered through the movie: sly references to ''A Clockwork Orange,'' ''The Shining'' and predominantly ''2001: A Space Odyssey.'' But on a deeper level Mr. Spielberg seems to be attempting the improbable feat of melding Kubrick's chilly, analytical style with his own warmer, needier sensibility. He tells the story slowly and films it with lucid, mesmerizing objectivity, creating a mood as layered, dissonant and strange as John Williams's unusually restrained, modernist score.
The mood shifts abruptly -- and the picture becomes dreamier, funnier and intellectually riskier -- when David is abandoned, along with his cybernetic teddy bear (with the voice of Jack Angel), in a dark forest. With exemplary childlike reasoning that bears out his creator's hunches, David conflates his own story with Pinocchio's and sets out to find the blue fairy who will transform him into a real boy. Joining him on his quest is a sex-slave mecha called Gigolo Joe, played with saucy, oily charm by Jude Law.
Once expelled from the cocoon of Henry and Monica's house -- a scrupulously imagined retro-futuristic suburban palace, as if the Jetsons had shopped at Restoration Hardware -- David plunges into the dystopian underside of this disconcertingly familiar future. He and Joe are captured by bounty hunters and herded into cages at a Flesh Fair, a combination revival meeting and monster-truck rally at which people express their hatred of mechas by blowing them up and dousing them with acid.
Presiding over the fair is Lord Johnson-Johnson (Brendan Gleeson), who styles his carnival a ''celebration of life'' devoted to ''demolishing artificiality'' and the securing of ''a truly human future.'' ''Originality without purpose is a white elephant,'' he rants.
The Flesh Fair sequence is a lacerating tug of war between thought and feeling, in which we are pulled to the side of Johnson-Johnson's victims even as we are forced to contemplate the truth of his statements. At this moment ''A.I.'' becomes not only an earnest meditation on the nature of humanity -- and a more profound inquiry into the moral scandal of dehumanization than either ''Schindler's List'' or ''Amistad'' -- but also a reflection on the paradoxical nature of cinematic illusion.
Movies are not real, and few moviemakers have been as adept at finding original ways to counterfeit human emotion as Mr. Spielberg. (The Flesh Fair might be a Dogma 95 pep rally, or a meeting of dyspeptic film critics protesting the movie's lavish and startling special effects, including the computer-enhanced broken-down robots doomed to destruction.) But here Mr. Spielberg confronts a crucial and difficult question: Do the virtual selves we project into the world, on screen and elsewhere, bring us closer to knowing who we are, or do they distract us from our search for that knowledge? ''I am, I was,'' Joe says to David as they part company, asserting as a flat fact what the movie takes as unanswerable questions: What are we? What will we become?
''Stories are real,'' David insists to Monica before she leaves him to his fate. They aren't, of course. But stories that touch on the essential and unsolvable mysteries of who we are can nonetheless be true, and they are truest when they illuminate those mysteries while leaving them intact.
After the Flesh Fair and a tour of the artificial fleshpots of Rouge City (which looks like a fusion of the old Times Square and the new), David and Joe, with the help of Robin Williams's voice and William Butler Yeats's poetry, come to the end of the earth, the half-submerged island of Manhattan. ''A.I.'' goes even further: on at least two occasions, it seems to be ending, only, like ''2001,'' to push into ever stranger territory, ultimately leaving the human world altogether.
The final scenes are likely to provoke argument, confusion and a good deal of resistance. For the second time the movie swerves away from where it seemed to be going, and Mr. Spielberg, with breathtaking poise and heroic conviction, risks absurdity in the pursuit of sublimity.
The very end somehow fuses the cathartic comfort of infantile wish fulfillment -- the dream that the first perfect love whose loss we experience as the fall from Eden might be restored -- with a feeling almost too terrible to acknowledge or to name. Refusing to cuddle us or lull us into easy sleep, Mr. Spielberg locates the unspoken moral of all our fairy tales. To be real is to be mortal; to be human is to love, to dream and to perish.
''A.I.'' is rated PG-13 (Parents strongly cautioned). It has a few moments of violence and sexual innuendo, and its themes may upset and confuse young children used to happy, reassuring fairy tales.
A.I.