I've been in the position of refusing to carry out what I considered an unlawful order, and when brought before the Branch Chief to explain myself, the supe had tried to turn the tables by saying that he was the one trying to "stop" me from doing that which I had refused to do. I told the Branch Chief to fire me if he believed the piece of shit.
On another occasion, my partner and I were questioned by the SAC and DSAC as to why a guy who had made a big pest of himself wasn't brought in in handcuffs and bloodied up. My reply to that was "and you'd have backed us up all the way, right?"...to which the reply was crickets.
It took virtually nothing at all for me to have two relatively open and shut internal affairs investigations. (Cleared on both, without substance.) This was 20 years ago or so. Nowadays, it's way worse.
Better have your shit wired tight before you leave the office, precinct, squad room, what have you...because very few folks will have your back when the chips are down.