Righteous Kill
(2008)

As the movie goes on, almost all clues lead to Turk (Robert De Niro) being the murderer of all the convicts.

In the end, Turk witnesses Rooster (Al Pacino) kill Spider (50 Cent). Rooster makes Turk sit down and read into a recording security camera a page from the notebook the shrink makes them write in, a confession. This is why throughout the movie you see Turk confessing to the murders, it's all a recording made by Rooster. After a brief chase scene, where Karen gets involved, Turk chases Rooster down with Karen's gun. They talk for a short while. Rooster gives Turk two options: be shot or let him run away. Turk refuses to let him go, wanting to arrest him and bring him in. Rooster moves to shoot but Turk is faster, shooting Rooster first. Rooster falls to the ground and Turk calls for an ambulance using Rooster's radio. Rooster dies there and Turk calls off the ambulance.

In the final scene, Turk is in an office with other officers. They all conclude that the "poem murders" were all committed by Rooster. 

Thanks Sal!