Section 167. The mayor, aldermen or board of selectmen may order that all dogs shall be restrained from running at large during such times as shall be prescribed by the order. Once passed, a certified copy of the order shall be posted in at least 2 public places in the city or town or, if a daily newspaper is published in the city or town, by publishing a copy once in that newspaper. Following publication, the mayor, aldermen or board of selectmen may issue a warrant to a police officer or constable in a city or town, who shall, not sooner than 24 hours after the publication of the notice, euthanize all dogs in a humane manner that are found running at large contrary to the order. Notwithstanding the foregoing, a police officer or constable may, in the officer's or constable's discretion, hold any such dog for not more than 7 days. If the owner of the dog claims it and pays to the officer or constable a penalty of $40 for each day that the dog has been held, the dog shall be returned to its owner. The amount shall be paid over to the city or town.