At issue is the validity of a judgment in favor
of plaintiff-respondent (hereafter plaintiff) against defendant-appellant (hereafter defendant), foreclosing a mortgage on a town house in Manhattan owned by defendant. Married in 1938, the parties have been engaged in litigation of one sort or another since 1953, and since entry of the judgment herein have been divorced. The property which is the subject of this action had been held by the parties as tenants by the entirety. In 1959 they executed an agreement providing in part:
‘ ‘ Third: Harold agrees that promptly upon the execution of this agreement, that he will sell, assign, transfer and deed over to Irene, all of his right, title and interest in and to the premises and furniture and furnishings now owned in common by the parties and known by the street number 34 East 69th Street, New York City. Said premises are currently subject to a mortgage in the- approximate sum of $50,000. Harold agrees that he will upon the due date of said mortgage or at any time before in his discretion, pay and discharge the principal sum of said mortgage and until said mortgage has been paid and discharged, that he will pay all interest charges thereon. * * *
1 ‘ Seventh: In consideration of the sale and transfer by deed of Harold’s interest in the said premises * * * and in further consideration of his undertaking to pay and discharge the existing mortgage thereon, Irene agrees that upon the execution and delivery to her by Harold of a deed conveying to her * * * the premises 34 East 69th Street, New York City, that she will at the same time and hereby does assign, transfer and set over to Harold, all of her right, title and interest in and to all shares of stock of Island Industries, Inc., including any and all interest she has or may have in and to any and all shares of stock of Island Rubber Corp., or any beneficial interest therein which she now has or had at any time. ’ ’
Paragraph Fourth of the agreement provided in part: “It is further agreed * * * that unless and until Irene shall at any time hereafter institute a legal proceeding against Harold for separation or divorce, that he will pay to her for her personal use and maintenance of every kind, except as herein otherwise provided, the sum of $30,000 per annum, payable monthly. Harold further agrees, that in addition, he will pay all real estate taxes assessed against the said premises 34 East 69th Street * ■ * * so long as they are owned by Irene. ’ ’
Early in 1960 the parties executed an agreement modifying the 1959 agreement by substituting a new paragraph “ Fourth ” inter alia increasing the annual payment to defendant to $37,500. *487The provision for payment of taxes on the 69th Street property remained the same. In October of 1960 the defendant commenced an action against the plaintiff, seeking in addition to other relief, reformation of certain portions of the agreements on the ground of fraud or mutual mistake. On appeal from denial of a motion to dismiss a portion of the complaint in that action it was urged by the present plaintiff that the agreements, insofar as they related to payments for his wife’s support, were in violation of the then section 51 of the Domestic Relations Law (now section 5-311 of the General Obligations Law). In affirming the denial (Lacks v. Lacks, 12 N Y 2d 268, 271) Judge Van Voorhis, writing for the majority, said: “ The husband contends, on this appeal, that an agreement by a husband is void to pay an annual sum to the wife in lieu of her support and maintenance while they are living together as husband and wife. That contention is correct. (Garlock v. Garlock, 279 N. Y. 337). * * * Consequently the third cause of action would be insufficient in law if it concerned merely the reformation of this clause in the agreements. It is difficult upon a motion of this character to determine whether this portion of these contracts is so integral a part of them as to vitiate them in their entirety. If this clause be severable, it is possible that other paragraphs in the agreements may be capable of reformation in the manner applied for by plaintiff on other aspects of the third cause of action. Whether these agreements are divisible in this respect, with the consequence that this void portion would be severable, or whether the contracts are entire, is a matter to be decided after a trial rather than upon a motion addressed to the pleadings.” The latter action has not been brought to trial.
Pursuant to the agreements plaintiff conveyed his interest in the house to defendant and the latter transferred her shares of stock to plaintiff. Plaintiff made the mortgage payments and paid the taxes until January of 1963 at which time he apparently paid the balance due on the mortgage but took an assignment thereof instead of discharging it. Thereafter, he paid no taxes and in 1966 commenced this action to foreclose the mortgage, alleging defendant’s failure to pay the installments of principal and interest due January 1, 1963 and thereafter, and the taxes assessed against the property. As a defense and counterclaim, defendant alleged the agreements of 1959 and 1960 and asked judgment “dismissing the complaint, that defendant be required specifically to perform said agreement, that if specific performance is not granted defendant be granted *488judgment against plaintiff in damages * * * and for such other and further relief as to the court may seem just and proper.” Defendant appeals from an order granting plaintiff’s motion to dismiss the defense and counterclaim and from the subsequent foreclosure judgment.
We conclude that the plaintiff’s motion to dismiss should have been denied and that on the undisputed facts the complaint should be dismissed and defendant given judgment on her counterclaim.
We see no impediment to the agreement evidenced by paragraphs Third and Seventh of the 1959 instrument whereby plaintiff agreed to deed his interest in the house and pay off the mortgage in exchange for defendant’s transfer of stock. (Domestic Relations Law, § 50; General Obligations Law, § 3-309.) That defendant has fully performed her part of the agreement is not disputed and plaintiff has performed to the extent of conveying to defendant his interest in the property. It seems to us that the transaction is clearly severable from that portion of the agreement held to be void and plaintiff was obliged to pay and discharge the mortgage. " Whether a given transaction will be held, in legal effect, to operate as a payment and discharge, which extinguishes the mortgage, or as an assignment, which preserves and keeps it on foot, does not depend so much upon the form of the words used as upon the relations subsisting between the parties advancing the money and the party executing the transfer or release, and their relative duties. If the money is advanced by one whose duty it is, by contract or otherwise, to pay and cancel the mortgage, and to relieve the mortgaged premises of the lien, a duty in the proper performance of which others have an interest, the transaction will be held to be a release, and not an assignment, even though in form it purports to be an assignment.” (38 N. Y. Jur., Mortgages and Deeds of Trust, § 248, pp. 482-483; Mertens v. Wakefield, 35 Misc. 501.)
“ Equity regards and treats that as done which in good conscience ought to be done ” (2 Pomeroy, Equity Jurisdiction [5th ed.], § 364, p. 10), and we hold that plaintiff’s payment of the mortgage debt discharged the mortgage and he was without standing to maintain this action.
Formulating the relief to be accorded defendant on her counterclaim presents some practical difficulty. At the foreclosure sale the property was purchased by the Government of Iran for $342,500, and it may be anticipated that any attempt to regain its possession will be met by a claim of sovereign or diplomatic immunity. A ‘‘ court of equity has the power of devising its *489remedy and shaping it so as to fit the changing circumstances of every case and the complex relations of all the parties.” (1 Pomeroy, Equity Jurisprudence [5th ed.], § 109, p. 141.) It seems to us that justice will be served by directing that plaintiff account for and pay to defendant the proceeds of the foreclosure sale, crediting the plaintiff with any portion thereof found to be properly chargeable to defendant.
The accounting will necessarily entail fixing responsibility for the payment of real estate taxes. The validity of plaintiff’s agreement to pay such taxes depends upon whether it constitutes an agreement ‘ ‘ to pay an annual sum to the wife in lieu of her support and maintenance while they are living together as husband and wife,” or is severable from the lump sum provision of the agreement. (Lacks v. Lacks, 12 N Y 2d 268, 271, supra.)
It is noted that in the 1960 agreement the payment of the lump sum is conditioned upon defendant’s not instituting separation or divorce proceedings against plaintiff and upon her owning and maintaining the 69th Street property and making it available to the parties’ children. If she sells or ceases to reside in the property or it is not available to the children, the annual payment is reduced from $37,500 to $30,000 and if she sues plaintiff for divorce or separation the payments terminate entirely. On the other hand, plaintiff’s payment of the real estate taxes is conditioned only upon defendant’s ownership of the property, and the same is true of paragraph Twelfth of the 1959 agreement requiring plaintiff to pay 50% of the cost of essential major repairs. Since such payments are required whether or not defendant occupies the property, it seems to us that they may be considered not as payment in lieu of her support and maintenance but rather, although not specifically so stated, as part of the transaction transferring the house in exchange for the stock. Accordingly, plaintiff shall not be credited with the amount of real estate taxes paid by him.
The judgment should be reversed on the law and the facts and vacated, the order dismissing the defense and counterclaim should be reversed, the motion denied, the counterclaim severed and interlocutory judgment granted thereon directing an accounting at Special Term in accordance with this opinion, with costs and disbursements to the defendant-appellant in the court below and of this appeal. Settle order.
McG-ivern, J. P., Markswich, Ktjpeermak and Stetjer, JJ., concur.
Judgment, Supreme Court, New York County, entered on or about December 17, 1968, unanimously reversed, on the law and *490the facts and vacated; order of said court, entered on May 17, 1968, unanimously reversed, the motion denied, the counterclaim severed and interlocutory judgment granted thereon directing an accounting at Special Term in accordance with the opinion of this court filed herein, with costs and disbursements to defendant. Defendant-appellant shall recover of plaintiff-respondent one bill of $60 costs and disbursements of these appeals.
Settle order on notice.