Section 59A. Cities, towns and fire districts may, by ordinance or by-law, or by vote of the board of aldermen, selectmen or of the prudential committee or board exercising similar powers, authorize their respective fire departments to go to aid another city, town, fire district or area under federal jurisdiction in this commonwealth or in any adjoining state in extinguishing fires therein, or rendering any other emergency aid or performing any detail as ordered by the head of the fire department, or the Joint Base Cape Cod fire district and while in the performance of their duties in extending such aid the members of such departments shall have the same immunities and privileges as if performing the same within their respective cities, towns or districts. Any such ordinance, by-law or vote may authorize the head of the fire department to extend such aid, subject to such conditions and restrictions as may be prescribed therein. The words ''fire departments'' as used in this section shall mean lawfully organized fire fighting forces, however constituted.
During the course of rendering such aid to another municipality, the municipality rendering aid shall be responsible for the operation of its equipment and for any damage thereto, and, subject to the limitations of municipal liability, for personal injury sustained or caused by a member of its fire department, and for any payments which it is required to make to a member of said department or to his widow or other dependents on account of injuries or death, notwithstanding paragraph (b) of subdivision (4) of section seven of chapter thirty-two, unless such municipalities have a written agreement to the contrary.