No police officer shall beat or strike any prisoner in his custody or any other person with a gun or club, unless the same be absolutely necessary to protect himself from serious bodily injury. Any police officer violating the provisions of this section shall be subject to dismissal. (Code 1941, Art. 109-13)