Section 7. The inspector of buildings, building commissioner or local inspector, or if there are none, in a town, the board of selectmen, or person or board designated by local ordinance or by-law, shall be charged with the enforcement of the zoning ordinance or by-law and shall withhold a permit for the construction, alteration or moving of any building or structure if the building or structure as constructed, altered or moved would be in violation of any zoning ordinance or by-law; and no permit or license shall be granted for a new use of a building, structure or land which use would be in violation of any zoning ordinance or by-law. If the officer or board charged with enforcement of zoning ordinances or by-laws is requested in writing to enforce such ordinances or by-laws against any person allegedly in violation of the same and such officer or board declines to act, he shall notify, in writing, the party requesting such enforcement of any action or refusal to act, and the reasons therefor, within fourteen days of receipt of such request.
No local zoning law shall provide penalty of more than three hundred dollars per violation; provided, however, that nothing herein shall be construed to prohibit such laws from providing that each day such violation continues shall constitute a separate offense. No action, suit or proceeding shall be maintained in any court, nor any administrative or other action taken to recover a fine or damages or to compel the removal, alteration, or relocation of any structure or part of a structure or alteration of a structure by reason of any violation of any zoning by-law or ordinance except in accordance with the provisions of this section, section eight and section seventeen; provided, further, that if real property has been improved and used in accordance with the terms of the original building permit issued by a person duly authorized to issue such permits, no action, criminal or civil, the effect or purpose of which is to compel the abandonment, limitation or modification of the use allowed by said permit or the removal, alteration or relocation of any structure erected in reliance upon said permit by reason of any alleged violation of the provisions of this chapter, or of any ordinance or by-law adopted thereunder, shall be maintained, unless such action, suit or proceeding is commenced and notice thereof recorded in the registry of deeds for each county or district in which the land lies within six years next after the commencement of the alleged violation of law; and provided, further that no action, criminal or civil, the effect or purpose of which is to compel the removal, alteration, or relocation of any structure by reason of any alleged violation of the provisions of this chapter, or any ordinance or by-law adopted thereunder, or the conditions of any variance or special permit, shall be maintained, unless such action, suit or proceeding is commenced and notice thereof recorded in the registry of deeds for each county or district in which the land lies within ten years next after the commencement of the alleged violation. Such notice shall include names of one or more of the owners of record, the name of the person initiating the action, and adequate identification of the structure and the alleged violation.
The superior court and the land court shall have the jurisdiction to enforce the provisions of this chapter, and any ordinances or by-laws adopted thereunder, and may restrain by injunction violations thereof.