(a) A person is justified in using physical force upon another person in order to defend himself or herself or a third person from what he or she reasonably believes to be the use or imminent use of unlawful physical force by that other person, and he or she may use a degree of force which he or she reasonably believes to be necessary for the purpose. A person may use deadly physical force, and is legally presumed to be justified in using deadly physical force in self-defense or the defense of another person pursuant to subdivision (5), if the person reasonably believes that another person is:
(1) Using or about to use unlawful deadly physical force.
(2) Using or about to use physical force against an occupant of a dwelling while committing or attempting to commit a burglary of such dwelling.
(3) Committing or about to commit a kidnapping in any degree, assault in the first or second degree, burglary in any degree, robbery in any degree, forcible rape, or forcible sodomy.
(4) Using or about to use physical force against an owner, employee, or other person authorized to be on business property when the business is closed to the public while committing or attempting to commit a crime involving death, serious physical injury, robbery, kidnapping, rape, sodomy, or a crime of a sexual nature involving a child under the age of 12.
(5) In the process of unlawfully and forcefully entering, or has unlawfully and forcefully entered, a dwelling, residence, business property, or occupied vehicle, or federally licensed nuclear power facility, or is in the process of sabotaging or attempting to sabotage a federally licensed nuclear power facility, or is attempting to remove, or has forcefully removed, a person against his or her will from any dwelling, residence, business property, or occupied vehicle when the person has a legal right to be there, and provided that the person using the deadly physical force knows or has reason to believe that an unlawful and forcible entry or unlawful and forcible act is occurring. The legal presumption that a person using deadly physical force is justified to do so pursuant to this subdivision does not apply if:
a. The person against whom the defensive force is used has the right to be in or is a lawful resident of the dwelling, residence, or vehicle, such as an owner or lessee, and there is not an injunction for protection from domestic violence or a written pretrial supervision order of no contact against that person;
b. The person sought to be removed is a child or grandchild, or is otherwise in the lawful custody or under the lawful guardianship of, the person against whom the defensive force is used;
c. The person who uses defensive force is engaged in an unlawful activity or is using the dwelling, residence, or occupied vehicle to further an unlawful activity; or
d. The person against whom the defensive force is used is a law enforcement officer acting in the performance of his or her official duties.
(b) A person who is justified under subsection (a) in using physical force, including deadly physical force, and who is not engaged in an unlawful activity and is in any place where he or she has the right to be has no duty to retreat and has the right to stand his or her ground.
(c) Notwithstanding the provisions of subsection (a), a person is not justified in using physical force if:
(1) With intent to cause physical injury or death to another person, he or she provoked the use of unlawful physical force by such other person.
(2) He or she was the initial aggressor, except that his or her use of physical force upon another person under the circumstances is justifiable if he or she withdraws from the encounter and effectively communicates to the other person his or her intent to do so, but the latter person nevertheless continues or threatens the use of unlawful physical force.
(3) The physical force involved was the product of a combat by agreement not specifically authorized by law.
(d)(1) A person who uses force, including deadly physical force, as justified and permitted in this section is immune from criminal prosecution and civil action for the use of such force, unless the force was determined to be unlawful.
(2) Prior to the commencement of a trial in a case in which a defense is claimed under this section, the court having jurisdiction over the case, upon motion of the defendant, shall conduct a pretrial hearing to determine whether force, including deadly force, used by the defendant was justified or whether it was unlawful under this section. During any pretrial hearing to determine immunity, the defendant must show by a preponderance of the evidence that he or she is immune from criminal prosecution.
(3) If, after a pretrial hearing under subdivision (2), the court concludes that the defendant has proven by a preponderance of the evidence that force, including deadly force, was justified, the court shall enter an order finding the defendant immune from criminal prosecution and dismissing the criminal charges.
(4) If the defendant does not meet his or her burden of proving immunity at the pre-trial hearing, he or she may continue to pursue the defense of self-defense or defense of another person at trial. Once the issue of self-defense or defense of another person has been raised by the defendant, the state continues to bear the burden of proving beyond a reasonable doubt all of the elements of the charged conduct.
(e) A law enforcement agency may use standard procedures for investigating the use of force described in subsection (a), but the agency may not arrest the person for using force unless it determines that there is probable cause that the force used was unlawful.