Use of force — When lawful.
The use, attempt, or offer to use force upon or toward the person of another is not unlawful in the following cases:
(1) Whenever necessarily used by a public officer in the performance of a legal duty, or a person assisting the officer and acting under the officer's direction;
(2) Whenever necessarily used by a person arresting one who has committed a felony and delivering him or her to a public officer competent to receive him or her into custody;
(3) Whenever used by a party about to be injured, or by another lawfully aiding him or her, in preventing or attempting to prevent an offense against his or her person, or a malicious trespass, or other malicious interference with real or personal property lawfully in his or her possession, in case the force is not more than is necessary;
(4) Whenever reasonably used by a person to detain someone who enters or remains unlawfully in a building or on real property lawfully in the possession of such person, so long as such detention is reasonable in duration and manner to investigate the reason for the detained person's presence on the premises, and so long as the premises in question did not reasonably appear to be intended to be open to members of the public;
(5) Whenever used by a carrier of passengers or the carrier's authorized agent or servant, or other person assisting them at their request in expelling from a carriage, railway car, vessel, or other vehicle, a passenger who refuses to obey a lawful and reasonable regulation prescribed for the conduct of passengers, if such vehicle has first been stopped and the force used is not more than is necessary to expel the offender with reasonable regard to the offender's personal safety;
(6) Whenever used by any person to prevent a mentally ill, mentally incompetent, or mentally disabled person from committing an act dangerous to any person, or in enforcing necessary restraint for the protection or restoration to health of the person, during such period only as is necessary to obtain legal authority for the restraint or custody of the person.