(a) The use of force upon or toward another person is justifiable when the defendant believes that such force is immediately necessary for the purpose of protecting the defendant against the use of unlawful force by the other person on the present occasion.

(b) Except as otherwise provided in subsections (d) and (e) of this section, a person employing protective force may estimate the necessity thereof under the circumstances as the person believes them to be when the force is used, without retreating, surrendering possession, doing any other act which the person has no legal duty to do or abstaining from any lawful action.

(c) The use of deadly force is justifiable under this section if the defendant believes that such force is necessary to protect the defendant against death, serious physical injury, kidnapping or sexual intercourse compelled by force or threat.

(d) The use of force is not justifiable under this section to resist an arrest which the defendant knows or should know is being made by a peace officer, whether or not the arrest is lawful.

(e) The use of deadly force is not justifiable under this section if:

(1) The defendant, with the purpose of causing death or serious physical injury, provoked the use of force against the defendant in the same encounter; or

(2) The defendant knows that the necessity of using deadly force can be avoided with complete safety by retreating, by surrendering possession of a thing to a person asserting a claim of right thereto or by complying with a demand that the defendant abstain from performing an act which the defendant is not legally obligated to perform except that:

a. The defendant is not obliged to retreat in or from the defendant’s dwelling; and

b. The defendant is not obliged to retreat in or from the defendant’s place of work, unless the defendant was the initial aggressor; and

c. A public officer justified in using force in the performance of the officer’s duties, or a person justified in using force in assisting an officer or a person justified in using force in making an arrest or preventing an escape, need not desist from efforts to perform the duty or make the arrest or prevent the escape because of resistance or threatened resistance by or on behalf of the person against whom the action is directed.