[1] This is an appeal from an order sustaining a demurrer to the complaint, on the ground that it does not state a cause of action. Its allegations are in substance, that Campbell B. and Susannah B. Thomas, the owners of certain described real property, executed a mortgage thereon October 17, 1890, to secure a debt of $400; that a judgment foreclosing the mortgage was entered July 13, 1894; that the mortgage, judgment, and all rights of the mortgagee and judgment creditor have been assigned to the plaintiff, who is now the owner and holder thereof; that no sale under the judgment has taken place; that no part of the debt secured by the mortgage has been paid; that the defendant claims an interest in the .mortgaged premises under a tax deed executed June 30, 1899, upon tax sales made November 13, 1893, arid November 2, 1896; that the plaintiff is ready, able, and willing to pay the defendant all taxes he may have paid on the premises, together with lawful interest, costs, and expenses; that he offered to make such payment before this action was commenced; and that his offer was declined. The complaint also states facts showing- that defendant’s tax deed is void on its face, but alleges no defect in the tax proceedings, aside from the form of the tax deed. So the action is one wherein the plaintiff, claiming- to have a lien upon real property, seeks to avoid a tax deed which casts a cloud upon his security. Such an action may be maintained in this state. Battelle v. Wolven, 19 S. D. 87, 102 N. W. 297.
[2,3] But defendant contends that the complaint fails to show an existing lien in favor of the plaintiff, because the mortgage was merged in the judgment, and the judgment ceased to be a lien on the land before this action was commenced. It is conceded that this action was not commenced within 10 years after the judgment was docketed. “On filing a judgment roll upon a judgment directing in whole or in part the payment of money, it may be docketed with the clerk of the court in which it was rendered, * * * and it shall be a lien on all of the real property, except the homestead, in the county where the same is *611so docketed, of every person against whom any such judgment shall be rendered, and which he may have at the time of the docketing thereof in the county in which such real property is situated or which he shall acquire at any' time thereafter, for ten years from the time of docketing the same in the county where it was rendered.” Rev. Code Civ. Proc. § 321. It has been held that such a statute as this has no application to a judgment in an action to foreclose a mortgage, except as to any deficiency remaining after sale of the mortgaged premises. Huntington v. Meyer, 92 Wis. 557, 66 N. W. 500. Whether this be so or not, it is clear that the docketing of a proper judgment in such an action does not operate to extinguish the lien created by the parties to the mortgage. The lien created- by the statute attaches to all the real property of the debtor, except his homestead, in the county where the judgment is docketed, while the lien created by the contract attaches only to the property described in the mortgage. If the docketing of a judgment in an action to foreclose a real estate mortgage extinguishes the mortgage lien, leaving only the judgment lien, the collection of a debt secured by a mortgage on a homestead cannot be enforced when the debtor has no property other than a homestead. In such a case, if the mortgage lien merges in the judgment lien, the creditor loses his lien by attempting to enforce it. Certainly the Legislature did not intend the statute to have that effect. A recorded real estate mortgage imparts notice to the world that the land described therein is hypothecated for the performance of the obligation or obligations specified therein. An action to foreclose it is brought for the purpose of enforcing the existing lien, not for the purpose of creating any new rights or obligations. The recording of a notice of the pendencj" of such an action is not required. Rev. Code Civ. Proc. § 108. The lien of such a mortgagee is accessory to the obligation it secures; it is extinguished by the extinguishment of the obligation and by a sale of the mortgaged premises in satisfaction of the obligation; but it is not extinguished by the mere lapse of the time within which, under the provisions of the Code of Civil Procedure, an action may be brought upon the obligation. Rev. Civ. Code, §§ 2037, 2038. Green v. Frick, 25 S. D. 342, 126 N. W. *612579. The debt secured by the mortgage in the case at bar may have merged in the judgment which determined its validity and amount; but the lien created by the contract was neither merged in nor extinguished by such judgment. Though the form or evidence of the debt may have been changed, the unsatisfied, recorded contract remained. Whether the plaintiff's rights as the assignee of such contract are barred by any statute of limitations, of whether, for any reason, he should be estopped from asserting his rights, are matters of, defense, to be considered when properly pleaded.
No objections, other than the one discussed, having been suggested by counsel, the sufficiency of the complaint in other respects will not be considered. ' It may be proper, however, to observe that, whereas the defect in the form- of defendant’s tax deed might be cured by the issuing of another deed, and no attempt having' been made to redeem from the tax sales in the manner of within the time prescribed by the statute, attention should be given in the trial court to the question as to what defects or irregularities in the tax proceedings will justify a judgment in favor of the plaintiff. Gibson v. Pekarek, 25 S. D. 281, 126 N. W. 597; Id., 27 S. D. 423, 131 N. W. 728.
For the reasons stated, the order appealed from is reversed.