Hells on Earth, alas, abound, and many of them have bars and guards. We've had our own recent experience at Abu Ghraib, from which we continue to stagger in recovery, as if such things still have the power to shock. But it's nothing new: They're commonplace.

Even by that banal standard, though, what happened at Carandiru Holding Facility in Sao Paulo, Brazil, in 1992, was astounding. In America's worst prison riot, at Attica State Penitentiary in 1971, more than 40 people died. In the uprising at Carandiru 111 prisoners died.

The full nature of Yeats's characterization of "the foul rag-and-bone shop of the heart" was never clearer than on that day, when riot police with automatic weapons prowled the corridors of the old joint, shooting wildly as they went, seeing the whole facility as a target-rich environment. As you might expect, this very big Armageddon in a very small space is the climax of Hector Babenco's riveting new film, "Carandiru." It makes for a melancholy couple of minutes of movie watching; nothing dampens the mind like slaughter.

So the movie is powerful, if numbing. What movie about a massacre isn't? What is more provocative, however, is the extent to which Babenco manages to humanize his bad ugly prison boys, so that when the bullets fly, we cannot cling to the principle of demonization by which we exile the bad and the ugly and the imprisoned from our hearts. We know them too well as people.

The movie is based on two works. The first, officially, is a memoir by Dr. Drauzio Varella, who entered the prison as part of an AIDS project, got to know and respect the prisoners and regard them as human beings. The second is clearly Fernando Meirelles' great "City of God" (2002), set not in a prison but a Brazilian slum and chronicling three generations of thug life like a vast 19th-century novel, conjuring fathers and sons and grandsons as they struggled to survive in an environment where life is cheap, violence common and pleasure fleeting. Meirelles found stories everywhere he looked, and thus the film was like a cluster of narratives, a "Canterbury Tales" of urban dysfunction, each tale sharp, focused and moving, each fitting precisely into a larger pattern until a whole universe was evoked.

The truth is, Babenco -- who broke through to world prominence with "Pixote" in 1981, had an American career ("Kiss of the Spider Woman," "Ironweed") and then returned to Brazil -- isn't as good as the much younger Meirelles. His film is somehow less astringent, less tough, less honest. You feel him sentimentalizing. Still, it's brilliantly acted and designed.

Babenco has a gift for evoking the poetry of squalor, and his crumbling old place teems with boisterous, colorful life. It's so convincing, you find yourself searching for lice as you watch.

The crusading young doctor (played by Luiz Carlos Vasconcelos) is there not just to tend to the lacerations, bruises and occasional death by shank or club that prison necessarily entails, but also to lead a condom campaign, in an effort to stop the rampant AIDS epidemic. The point of view is his -- nonjudgmental, humane, ever curious -- as he enters the prison culture and begins to understand it. Babenco sums up this process early in the film: The young physician wanders down a corridor, which is narrow and confining, then steps suddenly into the yard, teeming with life and detail under a bright vault of sky. One has the sense of suddenly stepping into a vast new universe.

The doctor learns much. Each con, of course, has a nickname, an alibi and a colorful life story, and he draws them out, so that each life is dramatized. It's familiar and not familiar at once: a sexually charismatic car thief who can't choose between two women; an armored car heist expert who is undone by his partner's cheating wife; a pair of brothers, one a career prisoner, one a victim on his own vengeful rage, who end up cellmates; a hardened killer who suddenly feels the crush of guilt; a number of transsexuals, who've become the prison's female population.

One wishes Babenco had been a little more of an overall storyteller and less of a anecdotalist. When the riot that precipitates the massacre breaks out, it seems arbitrary. He's been studying the inmates of one corridor, their lives, their deaths, their clique politics, their internal culture, their drug habits, their status levels and command patterns with a great deal of focus, but the general pattern is lost.

As he explains it, a gang war broke out simultaneously with a soccer championship celebration. Things went wildly out of hand, the riot cops were called in and the bloodshed commenced. But neither of the gangs has been a subject of his investigations.

Still, as a 21/2-hour sentence to the graybar hotel, the movie can't be topped. It's a place you'd never want to go; the theater is close enough, thank you very much.

Carandiru (146 minutes, at Landmark E Street) is rated R for bloody violence, sexuality and drug use.

Police crack down on the uprising in "Carandiru," Hector Babenco's film about a 1992 prison riot in Brazil that left 111 inmates dead.Milhem Cortaz as Dagger, Sabotage as Weasles, and Wagner Moura as Zico, cons fully drawn by the film.