Movie review.

In "187," which opens Wednesday, Samuel L. Jackson plays terrorized big-city high school teacher Trevor Garfield. Garfield is a decent, dedicated man who is nearly killed by one of his students and later is driven to strike back. Jackson, whose eyes burn with pain and defiance throughout the movie, gives this part an unusual shot of passion, urgency, heart and tension.

As usual, Jackson is so good that he almost makes up for the movie's flaws. But those flaws prove overpowering.

"187," based on a script by one-time Los Angeles schoolteacher Scott Yagemann and directed with style and energy by Kevin Reynolds ("Waterworld"), begins pretty strikingly, as a gutsy, modern variation on "The Blackboard Jungle" or "To Sir, With Love." Then, like too many movies these days, it starts sinking into loony cliches and a paper-thin formula. Soon it becomes a bizarre and often ludicrous murder mystery, interrupted by machismo duels and forced tries at romance and social comment.

By the end, when Yagemann and Reynolds try to restage the Russian roulette scene from "The Deer Hunter," you can tell that the movie has long since snapped its ties to reality and become just another big-studio wish-fulfillment fantasy. And when we see the sentimental commencement ceremony scene -- with everything but a choir singing "You'll Never Walk Alone" -- the debacle is complete.

How can you waste material this potentially powerful? In the early parts of "187," set in Brooklyn -- where we see the stabbing incident that almost costs Garfield his life -- Reynolds uses his overheated camera style to magnify every emotion. Then he reintroduces us to Garfield 18 months later, and the once-charismatic science teacher is now a deeply wounded man who has relocated to Los Angeles and is working as a substitute teacher.

When Garfield enters his science class and begins to clash with his obstreperous "problem" students, especially Cesar (Clifton Gonzalez Gonzalez) and Benny Chacon (Lobo Sebastian), the movie seethes with tension. Cesar and Benny are infuriating, contemptuous bullies, amoral gangbangers who could kill without a qualm. The school principal is a weaselly bureaucrat who is scared of lawsuits. And Garfield's fellow teachers include the jaded and cynical gun nut Dave Childress (John Heard) and the fragile idealist Ellen Henry (Kelly Rowan).

The movie seems to be heading in a predictable but satisfying direction. It's the usual urban schoolyard battleground story, given a fresh slant by the modern L.A. locations and flashy visual style.

Then Yagemann pulls out his new plot gimmick: a suggestion that Garfield has gone psycho and started killing and attacking his students. Benny is found murdered, his rosary gone. Cesar gets one of his fingers chopped off. Ellen, to her horror, finds a rosary in Garfield's drawer -- and isn't mollified by the fact that he prays a lot.

And there's a sexy subplot: Garfield, discovering literary potential in promiscuous Rita (Karina Arroyave), schedules a tutoring session in his apartment, only to have Rita strip on his couch and proposition him.

"187" takes its title from the police designation for homicide, and, in a way, the movie is the high-school-teacher drama equivalent of the first "Dirty Harry." Garfield, like Clint Eastwood's Harry Callahan, is a tough guy caught between maniac punks with guns (his students) and sell-out superiors (his administrators). Is that what urban teachers are eventually driven to -- macho movie fantasies?

Watching Jackson play Garfield, though, you can almost understand the horrible contradiction that afflicts many urban teachers: trying to keep alive a spirit of learning in a climate of despair and terror.

Jackson endows Garfield with such emotional realism that, at first, he carries you past the first wave of cliches. Reinforced by the film's flashy camera work (the blurry background that convey his fear and alienation), he conveys a sense of honor against chaos.

And he's got good antagonists. Sebastian is chilling as the killer Benny. And Gonzalez Gonzalez, who brings off a more complex heavy, is magnetic. He shows clearly how Cesar's braggadocio is really a cover for inner panic, how he's bluffing his way past his own fears.

The movie may be bluffing too. Reynolds is obviously more comfortable and relaxed here than he was in the waterlogged logistics of "Waterworld." But, by the end, "187" has evolved into a standard urban western, a shift that makes nonsense of much of what happened before. We're left with Jackson's burning gaze and what it suggests: the world of hate and fear supplanting a world of knowledge and opportunity.