Every city and town may by ordinance prescribe what acts shall constitute offenses against the purity of its water supply and the punishment or penalties therefor and enforce them. The mayor of each city and town may appoint special police officers, with such compensation as the city or town may fix, who shall, after taking oath, have the powers of constables, and who may arrest with or without warrant any person committing, within the territory over which any city or town is given jurisdiction by this chapter, any offense declared by law or by ordinance, against the purity of the water supply, or which violate any rule or regulation lawfully promulgated by the state board of health for the protection of the purity of such water supply. Every special police officer whose appointment is authorized herein may take any person arrested for any such offense or violation before any court having jurisdiction thereof to be proceeded with according to law. Every such special police officer shall, when on duty wear in plain view a badge or shield bearing the words "special police" and the name of the city or town by which he or she has been appointed.