When the documentary "Presumed Guilty" opened in theaters here, many Mexicans saw for the first time the inside of one of their own courtrooms - and they watched the brutal, terrible grinding of the wheels of justice in stunned silence.

And now, the story gets even stranger: The movie about the Mexican judicial system is being ordered shut down by the Mexican judicial system.

Two weeks after the film opened to widespread acclaim, a federal judge ruled last Wednesday that it should be pulled from theaters because of a complaint from a witness who appears in the film as he testifies in a courtroom. The film portrays the murder trial of an innocent man who is found guilty not once but twice; the witness says he was filmed without his consent and, because of the movie, is taunted and threatened in the streets.

The judge's order to pull the film from theaters is being challenged in court this week. It was still in theaters Monday, but government officials said they would tell the distributor to stop screening the film on Tuesday. Long lines were reported over the weekend as people rushed while they can to see the film, whose subject matter has left reviewers reaching for Franz Kafka.

"This might very well become a landmark case on freedom of speech and censorship in Mexico," said Pablo Jimenez, a lawyer for the film distributor Cinepolis, the largest theater chain outside the United States, which is donating all profits from the film to establish legal defense clinics in Mexico.

"Presumed Guilty," which won a dozen prizes on the film-festival circuit, is the most popular documentary ever shown in Mexican theaters. According to the newspaper Reforma, pirated DVD copies of the film are outselling bootlegs of the recent crop of Oscar winners, an irony that does not escape Roberto Hernandez, a Mexican lawyer and co-director of the film.

"A film about illegality is being watched illegally," Hernandez said. "But at least people are seeing the movie."

After she saw the film, Margarita Zavala, the wife of President Felipe Calderon, tweeted: "bravo for the best movie!" When she heard that Judge Blanca Lobo Dominguez had ordered the film pulled, the first lady posted: "I hope it is resolved soon."

The mayor of Mexico City, Marcelo Ebrard, whose own cops, courts and judge play villainous roles in the film, told reporters that he would show it free of charge in the Zocalo, one of the largest plazas in Latin America. "It is not possible to stop people from watching a film in the 21st century," Ebrard said.

The film tells the story of Antonio Zuniga, who was picked up by police on the streets of a tough Mexico City barrio on Dec. 12, 2005, and charged with the murder of Jose Carlos Reyes, who was shot dead earlier in the day.

Zuniga was found guilty despite the fact that he did not know the victim; a dozen witnesses saw him working at his market stall at the time of the murder; tests showed he had not fired a weapon; and the one and only witness against him was first a suspect in the killing and then told police that three gang members had shot his cousin, the victim, over a small drug debt.

Zuniga won a rare retrial with the help of Hernandez and his wife, producer Layda Negrete, who discovered that Zuniga had been represented in his first trial by a defense lawyer with a phony diploma.

The filmmakers got permission to film the retrial. In Mexico, criminal cases are not presented to juries but to a judge, who does not hear oral testimony but reads through reams of affidavits. More than 90 percent of defendants never actually see a judge, never see an arrest warrant and are convicted without any physical evidence.

In the documentary, Zuniga is shown at his retrial sitting in the corner of the courtroom, behind bars, while the judge and lawyers discuss the case. When one of the police detectives is asked what evidence there is against the defendant, the officer says that "he must have done something," because he is in prison. When the prosecutor is later asked why she was pursuing an innocent man, she replies, "I'm not the judge; it's my job."

When she utters these words, cinema audiences usually groan.

In the climactic scene, Zuniga is allowed to confront his accuser, the eyewitness, who confesses that he never saw who shot his cousin. The judge finds him guilty anyway. Zuniga was freed only after the filmmakers showed the scenes of the retrial to a higher court.

Hernandez says it is wrong to simply condemn the lazy or corrupt police officers and judge in this typical case. "It is a problem with the whole system; it is not a problem of a few individuals," Hernandez said. "The system is rotten."