Whenever any inmate of the penitentiary offers or attempts to do any injury to any other person or property, either within the grounds or premises of the penitentiary or at any other place where said inmate may be, or whenever any inmate disobeys or resists any reasonable command of any officer or guard, any officer or guard may use reasonable means to defend himself or another or to enforce the observance of discipline.
N.D.C.C. § 12-47-24