(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 (4), 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) In the process of unlawfully and forcefully entering, or has unlawfully and forcefully entered, a dwelling, residence, 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, 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) 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.
(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.