No sheriff, deputy sheriff, police officer, or other officer of the law shall be allowed within the polling place without permission from the clerk or a majority of the inspectors, except to cast his or her ballot. Upon the failure of any of said officers to comply with this provision, the clerk or the inspectors or any one of them shall make an affidavit against such officer for his or her arrest.