Street Kings
(2008)

Detetctive Tom Ludlow (Keanu Reeves) has been set up by his Captain (Forest Whitaker) and his fellow officers.

It turns out Ludlow's former partner was not planning on turning him into Internal Affairs, he was actually going to rat out the Captain.

At the end, Ludlow shoots his Captain (Forest Whitaker) and the Internal Affairs Captain (Hugh Laurie) who - all through out the movie appeared to be trying to catch Ludlow doing something wrong, tells Ludlow he will help make it look like the other officers killed the Captain, clearing Ludlow.

Thanks Brian!