No person shall, at a state, city or town election, be eligible or act as an election officer in a voting precinct where he is a candidate for election; and if a person appointed an election officer becomes such a candidate, and does not forthwith resign his office, the mayor or selectmen, if he is a candidate at a state election, shall remove him from office before November first, or, if a candidate at a city election, the mayor shall so remove him at least eight days before the day of the election, or if a candidate at a town election the selectmen shall remove him before the election. Neither a town moderator nor any member of a board of selectmen shall be eligible or act as an election officer in a state or presidential primary, or state election.
Mass. Gen. Laws ch. 54, § 15