(1) Except as provided in subsection (2) of this section, conduct is justifiable when it is required or authorized by:
(a) The law defining the duties or functions of a public officer or the assistance to be rendered to such officer in the performance of his duties;
(b) The law governing the execution of legal process;
(c) The judgment or order of a competent court or tribunal;
(d) The law governing the armed services or the lawful conduct of war; or
(e) Any other provision of law imposing a public duty.
(2) Sections 28-1409 to 28-1416 shall apply to:
(a) The use of force upon or toward the person of another for any of the purposes dealt with in such sections; and
(b) The use of deadly force for any purpose, unless the use of such force is otherwise expressly authorized by law or occurs in the lawful conduct of war.
(3) The justification afforded by subsection (1) of this section shall apply:
(a) When the actor believes his conduct to be required or authorized by the judgment or direction of a competent court or tribunal or in the lawful execution of legal process, notwithstanding lack of jurisdiction of the court or defect in the legal process; and
(b) When the actor believes his conduct to be required or authorized to assist a public officer in the performance of his duties, notwithstanding that the officer exceeded his legal authority.