Notwithstanding any general, special or local law or ordinance to the contrary:
1. upon the commencement of a proceeding to foreclose a tax lien, the taxing district bringing the proceeding or any taxing district other than the one foreclosing the tax lien, having any right, title, or interest in, or lien upon, any parcel described in the petition of foreclosure may upon twenty days notice to all parties having any right, title, or interest in, or lien upon such parcel, move, at a special term in the court in which the foreclosure proceeding was brought, for an order granting such taxing district the temporary incidents of ownership of such parcel for the sole purpose of entering the parcel and conducting an environmental restoration investigation project upon such parcel.
2. unless prior to the return date of the motion brought pursuant to this section the parcel has been redeemed by a party having the right of redemption, the court shall enter an order granting such relief to such taxing district, or, if more than one taxing district applies for such right, to the taxing district which the court determines has the greatest public interest, but, where possible and proper, preferences for such relief should be accorded first to cities and villages, second to towns, and third to counties. Such order shall be granted upon such terms and conditions as the court shall deem just and proper to permit the environmental investigation to go on unhindered as well as to protect the interests of all other parties having a right, title, or interest in such parcel. Such order shall act as a stay to the foreclosure action on such parcel until the environmental restoration investigation project has been completed and the final investigation report filed with the court pursuant to subdivision four of this section or such other time as the court may deem proper, and particularly upon a finding by the court that the investigation has not been carried out in an expeditious manner.
3. such temporary incidents of ownership by such taxing district shall also qualify it as being the owner of such property to be eligible for funding from the state of New York for such environmental restoration investigation project under this article or for such funding from any source pursuant to any other state, federal, or local law, but such incidents of ownership shall not be sufficient to qualify it as the owner of such property for the purposes of holding it wholly or partially liable for any damages, past, present, or future from any release of any hazardous material, substance, or contaminant into the air, ground, or water, unless such release was caused by such taxing district.
4. within thirty days of the completion of the environmental restoration investigation project and the receipt by the taxing jurisdiction of the final report of such investigation, such taxing jurisdiction shall file such report with the court on notice to the court and all other parties of record, and the stay of the foreclosure shall be lifted (unless lifted earlier by a prior court order), and all incidents of temporary ownership of the taxing jurisdiction that was awarded such taxing district, except any right for the environmental restoration investigation project to be funded, shall cease to exist, and nothing in this subdivision shall preclude the taxing jurisdiction that conducted the environmental restoration investigation project or the taxing jurisdiction that commenced the foreclosure action, if it is a different taxing jurisdiction than the taxing jurisdiction which conducted the investigation, from withdrawing the parcel from foreclosure pursuant to section eleven hundred thirty-eight of the real property tax law.
5. all costs associated with any environmental restoration investigation project conducted pursuant to the authority of this section shall be added to the taxes owed to, and the tax lien of, the taxing district that undertook the environmental restoration investigation project pursuant to this section.