Life inside a notorious Brazilian prison where a 1992 riot led to the deaths of over a hundred inmates is the subject of Hector Babenco’s epic-length film, only his second since 1990. (He suffered from a serious illness during that time.) Based on a bestselling book by Dr. Drauzio Varella, who served as a physician in the vast and overcrowded Sao Paolo complex (with particular responsibility in AIDS prevention), “Carandiru” is a huge, sprawling portrait of the complex criminal society that dominated the prison and a cry of rage against the injustice the jail represented. Though the picture is only sporadically powerful and shows a streak of sentimentality beneath its gritty exterior, its strengths outweigh the weaknesses.

The film is basically constructed as a collection of interlocked vignettes concentrating on individual prisoners, tied together after a fashion by the presence of the doctor (a smiling, almost angelic Luiz Carlos Vasconcelos). The threads vary from the near comic to the tragic. In the first category falls an unlikely romance between a transvestite who calls himself Lady Di (Rodrigo Santoro) and the squat, decidedly unattractive Too Much (Gero Camillo); it even involves a wedding ceremony in the gay cellblock. At the other end of the spectrum is the connection between Zico (Wagner Moura), a long-time resident in jail for drug trafficking (and a user himself) and handsome newcomer Deusdete (Caio Blat), his younger childhood friend recently convicted of murder; their almost brotherly relationship takes a devastating turn. Among the other inmates on whom the film periodically settles are Ebony (Ivan de Almeida), the functional mayor of the criminal community; Highness (Ailton Graca), caught on visitors’ day between the same two women whose struggle over him preceded his incarceration; Chico (Milton Goncalves), an elderly prisoner who longs for some time with his family; Dagger (Milhem Cortaz), a brutal killer who experiences an unlikely conversion; unsuccessful robbers Antonio Carlos (Floriano Peixoto) and Claudiomiro (Ricardo Blat), who depend on each other as much in prison as before; and the pathetic, hapless Ezequiel (Lazaro Ramos), whose drug habit forces him to an appalling act of violence. Babenco makes the claustrophobic feel of Carandiru almost palpable, which most viewers would probably find intolerable if it were maintained without break over the film’s two-and-a-half hour running-time. Fortunately for them–if not the prisoners–the narrative periodically cuts to the outside world in well-done flashbacks to the inmates’ past lives, which, like the “contemporary” footage, sometimes have a comic and sometimes a poignant tone. At the close the narrative takes its necessary turn into historical tragedy as a sudden dispute between inmates, just after a prisoner soccer match, erupts into a full-scale riot that, largely for political reasons, results in a decision to use maximum force to restore order. These sequences are harrowing in the extreme.

“Carandiru” is quite effective in recreating the stifling atmosphere of the complex and the sense of hopelessness that prevailed there; there’s a grittiness to Walter Carvalho’s cinematography that suits the material well, and Clovis Bueno’s production design is grimily convincing. The picture also incisively draws a portrait of a system of internal control that was based more on a social structure the inmates devised themselves than on governance by the prison officials, and it offers a powerful, often shocking depiction of the culminating rebellion. The cast is admirable down the line, too, with Ramos, the younger Blat and Moura making especially powerful impressions. But though one might single out individual actors, this is essentially an ensemble piece that would fall apart like a poorly-assembled puzzle if all didn’t make positive contributions. On the other hand, the film exhibits a streak of underlying sympathy for the prisoners, derived no doubt from the book on which it’s based, which sometimes comes perilously close to rank sentimentality. Recurrent shots of the doctor’s beatific countenance, radiating optimism even in the face of the horror he sees, accentuate the feeling.

The film ends with footage of the Carandiru complex being dynamited to oblivion after its closure. It’s a satisfying conclusion to Babenco’s intense picture which, if somewhat overripe, builds real cumulative power.