The only antecedents that come to mind, in which the detectives serve a corrupt power and are blind to its injustices, but acknowledge a moral order and seek to apprehend or kill the pervert who violates it, would be "The Night of the Generals," about a police officer hunting a sex criminal in the Nazi general staff, and "In the Heat of the Night," where Rod Steiger is a bigoted lawman who must work with an African American detective played by Sidney Poitier to solve a crime.