(a) For the purposes of this section, the following words shall have the following meanings unless the context clearly requires otherwise: "Arm's length third party purchaser for value", an arm's length purchaser who pays valuable consideration, including a purchaser's heirs, successors and assigns, but not including the foreclosing party or mortgage note holder or a parent, subsidiary, affiliate or agent of the foreclosing party or mortgage note holder or an investor or guarantor of the underlying mortgage note including, but not limited to, the Federal National Mortgage Association, the Federal Home Loan Mortgage Corporation and the Federal Housing Administration.
"Deadline", 3 years from the date of the recording of the affidavit.
(d) Subsection (c) shall not apply if: (i) an action to challenge the validity of the foreclosure sale has been commenced in a court of competent jurisdiction by a party entitled to notice of sale under section 14 or a challenge has been asserted as a defense or a counterclaim in a legal action in a court of competent jurisdiction, including the housing court department pursuant to section 3 of chapter 185C, by a party entitled to notice of sale under said section 14 and a true and correct copy of the complaint or pleading asserting a challenge has been duly recorded before the deadline in the registry of deeds for the county or district in which the subject real property lies or in the land court registry district before the deadline; or (ii) a challenge to the validity of the foreclosure sale is asserted as a defense or counterclaim in a legal action in a court of competent jurisdiction, including the housing court department pursuant to said section 3 of said chapter 185C, by a party entitled to notice of sale under said section 14 who continues to occupy the mortgaged premises as that party's principal place of residence, regardless of whether the challenge was asserted prior to the deadline, and a true and correct copy of any pleading asserting the challenge in the legal action was duly recorded in the registry of deeds for the county or district in which the subject property lies or is duly filed in the land court registry district within 60 days from the date of the challenge or before the deadline, whichever is later.An attested true and correct copy of the complaint or pleading described in this subsection shall be accepted for recording in the registry of deeds or, in the case of registered land, in the land court registry district.
After the entry of a final judgment in a legal challenge under clause (i) or (ii) and the final resolution of any appeal of that judgment, the affidavit shall immediately become conclusive evidence of the validity of the sale if the final judgment concludes that the power of sale was duly exercised. If the final judgment concludes that the power of sale was not duly exercised, the foreclosure sale and affidavit shall be void. If the final judgment does not determine the validity of the foreclosure sale and the deadline for the affidavit to become conclusive has not expired, any party entitled to notice of sale under section 14 may file or assert another legal challenge to the validity of the foreclosure sale under said clause (i) or (ii).