Agnieszka Holland’s directorial career has had its ups and downs—a superb “Europa, Europa” in 1991 and “Olivier Olivier” in 1993, a charming “Secret Garden” in 1993, the deplorable “Total Eclipse” in 1995, the underrated “Washington Square” in 1997, the interesting “Third Miracle” in 1999, but little of consequence over the next decade. With “In Darkness,” however, she in effect challenges “Schindler’s List” on a smaller scale, and in some respects outdoes Spielberg, managing to avoid cheapening the material with easy sentiment and mawkishness even at the most obvious moments when they might intrude.

Like her more famous Hollywood colleague, Holland bases her film on a real incident, in which a group of Jews were hidden by a Pole in the sewers of Lvov until the arrival of Soviet troops allowed them to safely emerge. And as in “List,” the gentile protector—later honored in Israel among the “righteous”—is a complex, imperfect figure, in this instance Polek Socha, a roguish sewer inspector and part-time thief played with earthy directness by Robert Wieckiewicz. His initial decision to help a small group of Jews from the ghetto find refuge in the filthy tunnels he keeps open under the city streets when the Nazis herd their fellows off to the camps is based not on compassion, but profit. And even as he becomes more protective over time, he periodically threatens to abandon them, and when he returns he does so more from personal vanity than any high principle. (As he leads them out of hiding at the close, he introduces them as “my Jews.”)

Nor are those around him portrayed in simple terms. His wife Wanda (Kinga Preis), while expressing sympathy for Jews in general, is furious with her husband when she learns he’s placing them in danger for money. His friend and co-worker (and fellow thief) Szczepek (Krzysztof Skonieczny) shares Polek’s unthinking anti-Semitism (he’s astonished, for example, to learn that Jesus was a Jew) and bails out on his friend for fear of discovery, but suffers a cruel fate nonetheless. And hr has a Russian pal he once was in prison with who’s now working with the Nazis, and anxious to round up Jews in hiding—leading to some tense moments.

And the Jews are complex figures as well, not saintly victims. The richest of them, Mr. Chiger (Herbert Knaup), insists on bringing his two small children along with his wife (Maria Schrader), thereby dooming other adults to their fate. Another man (Marcin Bosek) callously chooses to leave behind his wife and daughter in order to include his mistress (Julia Kijowska), whom he later treats with equal selfishness when she becomes too much of a burden. The noblest of the lot is Mundek (Benno Furmann), who actually sneaks into the Jankowska internment camp in the guise of an inmate in order to rescue the sister of his fiancee. But even he, like the others, can be quarrelsome, ungrateful and suspicious, not only of Socha but of one another.

Holland, writer David F. Shamoon and cinematographer Jolanta Dylewska guide the tale expertly, balancing harrowing sequences beneath the streets—including some hair’s-breadth escapes and a flood as well as brutally honest episode focusing on the abandoned mistress—with others showing that the circumstances for the Poles above ground are awful as well, if not as terrible as the cruelty inflicted on their Jewish neighbors. The title refers primarily to the dank atmosphere in the sewers, of course, but the darkness refers more generally to the bleak, nightmarish reality that German occupation has brought to all of eastern Europe, as well as to the blindness of ordinary people infected with a blind contempt for “the Yids,” as they carelessly call them. It’s not unlike Holocaust survivor Eli Wiesel titling his memoir of life in the concentration camps “Night.”

Holland’s film is epic in theme (and, at over 2½ hours, length) but not in scale, which imparts an appropriate feeling of claustrophobia even in the outdoor moments, up to the very end. It uses the sense of confinement well in telling a story of reluctant heroism that’s remarkable for its nuance, complexity and power.