The sheriff has the legal custody and charge of the jail in his or her county and all prisoners committed thereto, except in cases otherwise provided by law. The sheriff may employ persons to carry out his or her duty to operate the jail and supervise the inmates housed therein for whose acts he or she is civilly responsible. Persons so employed by the sheriff shall be acting for and under the direction and supervision of the sheriff and shall be entitled to the same immunities and legal protections granted to the sheriff under the general laws and the Constitution of Alabama of 1901, as long as such persons are acting within the line and scope of their duties and are acting in compliance with the law.