The idea that someone in one of those positions should, on a regular basis be ALLOWED to substitute their "judgment" for their job is absurd. Institutions like the police and army, HAVE to do their job, even (especially!) when they find that job distasteful or even mildly wrong, because if they didn't, if a private, or a beat cop, or whoever got to willy nilly substitue their judgment for that of their CO, or of the law as it stands, in ANYTHING but the most outrageous situations, those institutions would entirely cease to function, as institutions, and you would get not the rule of Law, but the rule of Thugs.
In VERY EXTREME cases, "just doing my job" doesn't cut it, post Nuremberg. But in run of the mill cases (and arresting someone for breaking the law, even a silly, or wrong (in the eyes of cop/soldier) law is very run of the mill) "just doing my job" is needful.