504 - Execution of public duty.

     § 504.  Execution of public duty.        (a)  General rule.--Except as provided in subsection (b) of     this section, conduct is justifiable when it is required or     authorized by any law of the following:            (1)  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.            (2)  The law governing the execution of legal process.            (3)  The judgment or order of a competent court or        tribunal.            (4)  The law governing the armed services or the lawful        conduct of war.            (5)  Any other provision of law imposing a public duty.        (b)  Exceptions.--The other sections of this chapter apply     to:            (1)  The use of force upon or toward the person of        another for any of the purposes dealt with in such sections.            (2)  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.        (c)  Requisite state of mind.--The justification afforded by     subsection (a) of this section applies:            (1)  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            (2)  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.