Section 19B. Every city or town clerk under age seventy duly elected or appointed, except a temporary clerk, who has served therein continuously not less than five years, shall, notwithstanding any contrary provision of general or special laws, hold office during good behavior until he has attained age seventy in any city or town in which this section is accepted as hereinafter provided, but subject, however, to retirement under the provisions of any applicable general or special law relative to retirement systems.