To carry into effect these enumerated powers and all others by this Act, or by general laws conferred upon the said Town, or its Council, or any of its officers, the said Council shall have and possess full authority to make, pass, and adopt all needful ordinances, by-laws, and resolutions, not repugnant to the Constitution of the United States, or of this State, and to enforce any and all ordinances, by-laws, orders, or resolutions by prescribing for a violation thereof fines and penalties and imprisonments, either in the County Jail of Hancock County, or in the Town prison, if there be one. Such fines and terms of imprisonment shall not exceed the penalties imposed by the State for like offenses. Such fines and penalties shall be imposed and recovered, and such imprisonment inflicted and enforced, by and under the judgment of the Mayor of said Town, or in case of his absence or inability to act, then the Recorder may act in his place, or one of the justices within the district of Clay.