Section 24. The selectmen may, upon terms and conditions prescribed by them, and subject to the provisions of this chapter, so far as applicable, authorize a person to construct for private use upon, along and under the public ways of the town telegraph and telephone lines and lines for the transmission of electricity for light, heat or power. Upon the construction of any such line, the poles and structures thereof within the location of such ways shall become the property of the town, and the selectmen may regulate and control the same, may at any time require the persons using the same to make alterations in the location or construction thereof and may, after notice and a hearing, order the removal thereof. The town may at any time attach wires for its own use to such poles and structures, and the selectmen may permit other persons to attach wires for their private use thereto or to poles and structures constructed by the town, and may prescribe reasonable terms and conditions therefor. Whoever unlawfully injures or destroys any wire, pole, structure or fixture of any such line shall be punished by a fine of not more than five hundred dollars or by imprisonment for not more than two years, or both.