A parish in the actual occupancy of a church, meetinghouse or other building used for religious purposes may insure it against loss by fire. In case of such loss, the company insuring it shall not deny the occupancy of the parish, its legal existence or its right to maintain an action on the policy. The money so recovered shall be held by the parish in trust for repairing or restoring the building, and shall be so applied.