Section 4. Whenever any horses used in any department of any town shall, by reason of disability or disease, become unfit for use therein, the officer in charge of such department, in cities with the approval of the mayor, and in towns with the approval of the selectmen, instead of causing such horses to be sold, may transfer them to the custody of the Red Acre Farm, Incorporated, or any charitable society incorporated in the commonwealth for the prevention of cruelty to animals, or for the care and protection of dumb animals, if the society is willing to accept the custody thereof, to be disposed of as the society may deem best; provided, that the society upon receiving any such horse shall give a written agreement not to sell the horse or let the same for hire. If any horse so received shall thereafter be sold or let for hire, the proceeds of such sale or letting shall be the property of the town, and custody of the horse shall revert thereto.