A setoff or counterclaim may be pleaded as a defense to any cause of action, notwithstanding such setoff or counterclaim may be barred by the preceding provisions of this chapter, if such setoff or counterclaim so pleaded was the property or right of the party pleading the same at the time it became barred and at the time of the commencement of the action, and the same was not barred at the time the cause of action sued for accrued or originated; but no judgment for any excess of such setoff or counterclaim over the demand of the plaintiff as proved shall be rendered in favor of the defendant.
NMS § 37-1-15