
318 S.E.2d 907 (1984)
Neil BARNABY and Marina Village, Inc.
v.
Elbridge H. BOARDMAN and wife, Ruth R. Boardman and O.L. Graham, Trustee.
No. 833SC594.
Court of Appeals of North Carolina.
September 4, 1984.
*908 Kenneth M. Kirkman, P.A. by John E. Wray, Jr., Morehead, for plaintiff-appellees.
Sumrell, Sugg & Carmichael by Fred M. Carmichael and Rudolph A. Ashton, III, New Bern, for defendant-appellants.
JOHNSON, Judge.
On or about 28 December 1978, plaintiff, Barnaby, purchased a tract of land located in the Cedar Island Township of Carteret County from defendants for $150,000.00. At the closing, Barnaby paid to the defendants the sum of $5,000.00, and executed a promissory note secured by a purchase money deed of trust which provided that:
Grantor shall be entitled, from time to time, to the release or subordination of certain portions of the property conveyed herein, which release and subordination provisions are contained in that certain agreement between the parties hereto, dated the 15th day of December, 1978, the same being incorporated herein by reference.
Thereafter, defendants, in compliance with the above agreement, executed three deeds of release and a non-warranty deed, fully releasing the mortgaged property from the lien of the purchase money deed of trust.
On or about 26 May 1981, Barnaby conveyed the property to plaintiff, Marina Village, Inc., a corporation owned solely by the plaintiff and his wife. The deed conveying the property to Marina Village, Inc., contained the following:
THIS CONVEYANCE is made subject to the following deeds of trust and the Grantee agrees to assume and to pay said obligations under the terms of the Promissory notes and all other instruments creating any obligations on said property:
To O.L. Graham, Trustee for Elbridge H. Boardman and wife Ruth R. Boardman as recorded in Book 421, Page 262....
Subsequent to this conveyance, Barnaby failed to pay the indebtedness in accordance with the terms of the note. He also failed to comply with the terms of an agreement extending, at his request, the time for payment. Finally, on 8 February 1982, defendants commenced foreclosure proceedings.
On 17 February 1982, plaintiffs filed this action alleging that defendants had released all their interest in the property; that defendants Boardman had no authority to instruct defendant Graham to commence foreclosure proceedings; and that defendants misrepresented and concealed certain facts about the property.
Defendants' answer, admitting the release of the property from the lien of the purchase money deed of trust, contained an amended counterclaim and a second amended counterclaim, which are in pertinent part, as follows:
7. That there remains due and owing on the indebtedness evidenced by the aforesaid promissory note (Exhibit B) the sum of Eighty Two Thousand One Hundred Forty One and 56/100 Dollars ($82,141.56) as of December 15, 1982 [sic] and that interest continues to accrue according to the terms thereof.
8. That the Plaintiffs have failed and refused to pay said indebtedness according to the terms thereof and according to the terms of an extension of time heretofore agreed by the Defendants and that the Defendants have demanded payment of said indebtedness but the Plaintiffs have steadfastly failed and refused and continue to fail and refuse to pay said indebtedness; that the promissory note is presently in default and due and payable immediately and the Defendants, as holders of the promissory note have declared *909 the remainder of the debt due and payable.
....
10. That the Plaintiffs caused to be prepared and presented to Defendants for Defendants signatures, at the request of Plaintiffs, certain documents purporting to be deeds of release and a non-warranty deed describing the entire property described in the deed of trust (Exhibit C), all of which were executed by the Defendants at the request of Plaintiffs, and all is alleged in paragraphs 3 and 4 of the Plaintiff's second cause of action and if the Court should find that said documents release the property in its entirety from the provisions of the deed of trust (Exhibit C) the Defendants are unsecured in the payment of the aforesaid promissory note (Exhibit B) and will not have the remedy of foreclosure of said deed of trust.
All the parties filed motions to dismiss under G.S. 1A-1, Rule 12(b)(6). Defendants' motion to dismiss was allowed as to plaintiffs' first, third, and fourth claims for relief. These claims, which are not before us on review, are discussed, herein, insofar as they are applicable. From the Order granting plaintiffs' motion to dismiss the defendants' amended and second counterclaims, defendants appeal.
Defendants, in their sole assignment of error, contend that the court erred in dismissing their counterclaim pursuant to G.S. 1A-1, Rule 12(b)(6), for failure to state a claim upon which relief can be granted. We agree.
Under the "notice theory of pleading," a statement of a claim can withstand a motion to dismiss if it gives the other party notice of the nature and basis of the claim sufficient to enable the party to answer and prepare for trial. Sutton v. Duke, 277 N.C. 94, 176 S.E.2d 161 (1970). A claim for relief should not be dismissed unless it appears beyond doubt that the party is entitled to no relief under any state of facts which could be presented in support of the claim. Newton v. Insurance Co., 291 N.C. 105, 229 S.E.2d 297 (1976). Therefore, the essential question on a Rule 12(b)(6) motion, is whether the complaint, when liberally construed, states a claim upon which relief can be granted on any theory. Benton v. Construction Co., 28 N.C.App. 91, 220 S.E.2d 417 (1975). A counterclaim is substantially the allegations of a cause of action on the part of the defendant against the plaintiff. Therefore, these rules regarding the sufficiency of a complaint to withstand a motion to dismiss pursuant to G.S. 1A-1, Rule 12(b)(6), for failure to state a claim upon which relief can be granted, are equally applicable to a claim for relief by a defendant in a counterclaim.
In Realty Co. v. Trust Co., 296 N.C. 366, 250 S.E.2d 271 (1979), our Supreme Court, in construing the anti-deficiency judgment statute, held that a holder of a purchase money mortgage or deed of trust cannot disregard his security and bring an in personam action against the debtor on the note secured by the mortgage or deed of trust. Therefore, the anti-deficiency judgment statute, effectively limits the purchase money mortgagee, upon default, to the property conveyed or to the proceeds from its sale. The purchase money mortgagee is, also, expressly precluded from bringing an action on the note to recover a deficiency. Id. at 373, 250 S.E.2d at 275. It is axiomatic that the premise underlying the anti-deficiency judgment statute and the Realty Co., supra, decision, is that the holder of a purchase money mortgage or deed of trust, upon default, will receive the property conveyed or the proceeds from its sale. Neither the anti-deficiency statute nor Realty Co., supra, purports to determine or restrict the rights of a purchase money mortgagee, who at the time of default, is unsecure because he, the mortgagee, has released his security in accordance with the terms of an agreement contained in the purchase money mortgage or deed of trust.
The essential of defendants' counterclaim, quoted above, is that the anti-deficiency judgment statute has no application to their action on the note because they released the security from the lien of the *910 purchase money deed of trust. As a result, the promissory note is now unsecured. Hence, there is no outstanding deed of trust compelling application of the anti-deficiency judgment statute.
For the reasons stated, we hold that the order of the trial court granting plaintiffs' motion to dismiss defendants' counterclaim for failure to state a claim upon which relief could be granted, must be and is hereby reversed.
Reversed and remanded.
HEDRICK and HILL, JJ., concur.
