
368 N.W.2d 553 (1985)
H & F HOGS, a partnership, Plaintiff and Appellant,
v.
Kenneth HUWE and Betty Huwe, Defendants and Appellees.
Civ. No. 10838.
Supreme Court of North Dakota.
May 22, 1985.
*554 Michael G. Sturdevant (argued), Kenner, Halvorson & Sturdevant, Minot, for plaintiff and appellant.
John J. Petrik (argued), Pringle & Herigstad, Minot, for defendants and appellees.
ERICKSTAD, Chief Justice.
H & F Hogs [H & F], a partnership, appeals from a district court judgment dismissing its foreclosure action against Kenneth and Betty Huwe. We affirm.
In 1970 the Huwes acquired a one-half interest in a lot in Bergen, North Dakota. The Huwes executed a promissory note to H & F requiring five payments of $11,000, and also executed a mortgage on their interest in the property to secure the note.
The Huwes defaulted on the note and abandoned the premises in 1972. Between 1972 and 1975, the property was rented to other parties. No real estate taxes were paid after 1975, and in 1977 a tax sale was held and the property was acquired by McHenry County. A tax deed was issued to McHenry County after expiration of the redemption period, and the county sold the property on November 17, 1981.
H & F commenced this action, seeking foreclosure of the mortgage, on November 13, 1978. The complaint reserved the right to seek a deficiency judgment. The Huwes served an answer and apparently no further action was taken for nearly four years. On November 22, 1982, H & F filed a motion for leave to amend its complaint to sue directly on the note. The trial court denied the motion, holding that a suit on the note was prohibited by the anti-deficiency judgment statutes contained in Chapter 32-19, N.D.C.C.
The matter was set for trial on July 13, 1984. The parties stipulated to the facts and the case was submitted to the court for a decision on questions of law. The trial court subsequently issued its memorandum decision and judgment was entered dismissing the action.

I
H & F contends that the trial court erred in dismissing its action against the Huwes. In its memorandum decision the trial court held that, because the property had been sold for taxes and no redemption had occurred, the Huwes no longer had an interest in the property. There being no interest to foreclose, H & F could not comply with Sections 32-19-06 and 32-19-07, N.D. C.C., which require a foreclosure sale. The court concluded that H & F could not obtain a deficiency judgment without first foreclosing its mortgage and holding a sheriff's sale.
We have recently held that when a superior mortgagee forecloses its mortgage, an inferior mortgagee is no longer entitled to foreclose its mortgage but is left instead with a statutory right of redemption. National Credit Union Share Insurance Fund v. University Developers, 335 N.W.2d 559, 560 (N.D.1983). We further held that, upon expiration of the redemption period, the inferior mortgagee loses all right to or interest in the property. National Credit Union, supra, 335 N.W.2d at 561.
The rule of National Credit Union applies as well to a case such as this where the superior lien is a tax lien. H & F received written notice of the period for *555 redemption from the tax sale but failed to redeem the property. Section 57-28-08, N.D.C.C., provides that failure of a mortgagee to redeem from a tax sale passes all of the right, title, and interest of the mortgagee to the county by operation of law. Thus, H & F is in the same position as the inferior lienholder in National Credit Union it has lost all of its right to and interest in the property and therefore is not entitled to foreclose its mortgage.
H & F contends that National Credit Union does not preclude an action on the note indebtedness, because we specifically recognized that the inferior mortgagee in that case could pursue an action against personal guarantors. National Credit Union, supra, 335 N.W.2d at 561. An action against guarantors, however, is an action on their separate contracts of guaranty, not an action on the note indebtedness. Bank of Kirkwood Plaza v. Mueller, 294 N.W.2d 640, 643 (N.D.1980).
We conclude that H & F was not entitled to pursue its foreclosure action after it had lost its right to and interest in the property by failing to redeem from the tax sale. The trial court did not err in dismissing the foreclosure action.

II
H & F contends that the trial court erred in refusing to allow H & F to amend its complaint. The trial court, in denying the motion to amend, held that a mortgagee is precluded by the anti-deficiency judgment statutes from bringing suit against a mortgagor directly on the note.
If the complaint as amended would fail to state a claim upon which relief could be granted, it is not error for the trial court to deny the motion for leave to amend. Galloway v. Forum Publishing Co., 138 N.W.2d 798, 802 (N.D.1965). Thus, if the trial court's determination that H & F cannot sue on the note is correct, denial of the motion was not error.
Section 32-19-07, N.D.C.C., provides in pertinent part:
"Except as otherwise provided in sections 32-19-04 and 32-19-06, neither before nor after the rendition of a judgment for the foreclosure of a real estate mortgage or for the cancellation or foreclosure of a land contract made after July 1, 1951, shall the mortgagee or vendor, or the successor in interest of either, be authorized or permitted to bring any action in any court in this state for the recovery of any part of the debt secured by the mortgage or contract so foreclosed. It is the intent of this section that no deficiency judgment shall be rendered upon any note, mortgage, or contract given after July 1, 1951, to secure the payment of money loaned upon real estate or to secure the purchase price of real estate, and in case of default the holder of a real estate mortgage or land contract shall be entitled only to a foreclosure of the mortgage or the cancellation or foreclosure of the contract except as provided by sections 32-19-04 and 32-19-06."
Sections 32-19-04 and 32-19-06, N.D.C.C., set forth the procedure to be followed in seeking a deficiency judgment, and provide that a mortgagee may seek a deficiency judgment in a separate action. Section 32-19-06 specifies, however, that such an action may only be brought after the foreclosure and sheriff's sale:
"Where a note or other obligation and a mortgage upon real property have been given to secure a debt contracted subsequent to July 1, 1951, and the sale of the mortgaged premises has failed to satisfy in full the sum adjudged to be due and the costs of the action, the plaintiff may, in a separate action, ask for a deficiency judgment, if he has so indicated in his complaint, against the party or parties personally liable for that part of the debt and costs of the action remaining unsatisfied after the sale of the mortgaged premises. Such separate action for a deficiency judgment must be brought within ninety days after the sale of the mortgaged premises."
We have previously construed these statutes to prohibit an action by a mortgagee *556 against a mortgagor directly on the debt. McKee v. Kinev, 160 N.W.2d 97, 101 (N.D. 1968); Loraas v. Connolly, 131 N.W.2d 581, 586 (N.D.1964). As we stated in Loraas v. Connolly, supra, 131 N.W.2d at 586:
"Sections 32-19-04 and 32-19-06, supra, permit separate actions for deficiencies, and actions after foreclosure in the case of mortgages executed subsequent to July 1, 1951. They do not authorize actions upon a debt secured by a real property mortgage only, without resort to foreclosure. Since all actions upon the debt, or any part thereof, except as authorized by the foregoing sections, are barred, it follows that a mortgagee may not bring an action upon the secured debt, against the mortgagor, without resort to foreclosure."
H & F contends that we have recognized a mortgagee's right to sue directly on the note without first foreclosing its mortgage in First State Bank of Cooperstown v. Ihringer, 217 N.W.2d 857 (N.D.1974). In Ihringer, four persons executed a promissory note but only two executed the mortgage. We held that the mortgagee could sue a non-mortgagor debtor on the note without first resorting to foreclosure of the mortgage. Ihringer, supra, at Syll. ¶ 1.
H & F points to the following language as supporting its position:
"Thus it is our holding that the legislative intent after the 1951 amendment [to Chapter 32-19] was that the mortgagee or vendor could either (1) foreclose without asking for a deficiency judgment, or (2) foreclose, asking for a deficiency judgment in a separate action after the sale of the property, and obtain a judgment for only the difference between the mortgage debt plus costs and the fair value determined by a jury against both mortgagors and nonmortgagors personally liable on the note, or (3) sue on the note without foreclosure but with recovery limited to the difference between the amount due on the note plus costs and the fair value of the property determined by a jury." Ihringer, supra, 217 N.W.2d at 864.
This language must be read in context with the rest of our opinion in that case, particularly in light of the factual situation presented and the specific issues as stated by the Court.[1]Ihringer does not stand for the proposition that a mortgagee may forego its remedies under the mortgage and sue the mortgagor directly on the debt. Such a result would violate the provision of Section 32-19-07, N.D.C.C., which prohibits actions for recovery of any portion of the debt except as provided in Sections 32-19-04 and 32-19-06, N.D.C.C. Ihringer allows an action directly on the debt, without resort to foreclosure, only against non-mortgagors.
A lender that takes a mortgage on real property as security for a debt foregoes its right to proceed initially against the mortgagor directly on the debt, but receives in return the added protection of an interest in the property. The mortgagee may still recover any deficiency from the mortgagor, but must fully comply with the provisions of Sections 32-19-04 and 32-19-06, N.D.C.C., to do so. If we were to adopt the reasoning of H & F and allow a mortgagee to proceed against the mortgagor directly on the debt, the protections afforded mortgagors by the anti-deficiency judgment statutes would be largely vitiated.
We hold that H & F may not sue the Huwes directly on the debt evidenced by the promissory note. The trial court therefore did not err in denying the motion of H & F for leave to amend its complaint.
The judgment is affirmed.
GIERKE, LEVINE and VANDE WALLE, JJ., and PEDERSON, Surrogate Justice, concur.
PEDERSON, S.J., sitting in place of MESCHKE, J., disqualified.
NOTES
[1]  "The question before us is whether, and to what extent, the laws of this State regulating deficiency judgments apply to an action against a nonmortgagor debtor on a debt which is secured by a mortgage when foreclosure of the mortgage is not sought." First State Bank of Cooperstown v. Ihringer, 217 N.W.2d 857, 858 (N.D.1974).
