(A) A peace officer or other person who has an arrested person in his or her custody is justified in the use of force, except deadly force, to prevent the escape of the arrested person from custody as he or she would be justified in using if he or she were arresting the person.
(B) A guard or other peace officer is justified in the use of force which he or she reasonably believes necessary to prevent the escape from a penal institution of a person whom the officer reasonably believes to be lawfully detained in the institution under sentence for an offense or awaiting trail of commitment for an offense.
(C) Deadly force shall not be used to prevent escape under this section unless, based on the totality of the circumstances, deadly force is necessary to prevent death or great bodily harm to himself, herself, or such other person.
(ILCS Chapter 720, Act 5, § 7-9) (1981 Code, § 42.07, 7-9)