The description matches Internal Affairs (1990), starring Richard Gere as corrupt detective Dennis Peck, who has an affair with his partner Ray Avila’s (Andy García) wife. Ray discovers the betrayal, a confrontation ensues, Ray dies, and Dennis stages it as suicide. Later, Dennis confesses and is imprisoned.