The mayor and aldermen shall have authority to establish a municipal jail and provide regulations for the same in which to confine for punishment, when necessary, persons sentenced by the municipal court judge for violating any Town law or ordinance, or any penal section of this Charter, and for the detention of all persons committing or attempting to commit crimes; and any policemen of the Town shall have the right to confine such persons in the municipal jail to await their trial.