Much of the movie was filmed in the favelas, so the director was often in direct or indirect contact with the drug gangs he was fictionalizing. There was some contact with the police as well. The following is a paraphrasing (not a translation) of a story the director told in a television interview.
The scene he's referring to is one where officers torture a kid who looks about 15. They think he knows where a trafficker who killed their friend is. First they threaten to throw him off a cliff, then they suffocate him with a plastic bag and beat him. When that doesn't work, they threaten to rape him with a broomstick (the director was probably aware of the NYPD Louima case though I'm sure there's some Brazilian precedent as well). At that point the kid decides to talk--hooray for fascism (in our theatre nobody cheered, but some laughed). Keep reading, it just gets more incredible.
Padilha: We were filming a torture scene and we knew officers from BOPE were in the area. We were worried they would interfere with us filming the scene.
We start filming, and sure enough a guy from BOPE approaches us, and we stop filming to talk with him thinking "ok, this is it, they're going to shut us down".
Then he walks up to where the boy is kneeling on the ground and says, "Look, you're doing this all wrong. You hold the plastic bag like this, so that it doesn't leave a mark".
Obviously, the cops knew it would make a great story for the papers... it wasn't doofy innocence or even professional pride so much as a way to saying "We know you're making this film, and we don't give a fuck."