There is already a system in place. The Constitution. No one in the military OR civilian police is required to follow an UN-Constitutional order, and both the military and civilian departments have procedures for doing so.
Of course, this has been corrupted as elements of the military and civilian police have been corrupted.