
271 S.E.2d 348 (1980)
Darvin Ray DISHMAN and Virgie Mae Dishman
v.
James JARRELL.
No. 14177.
Supreme Court of Appeals of West Virginia.
October 28, 1980.
*349 Baer, Napier & Colburn, Helen M. Morris and William K. Napier, Huntington, for appellants.
No appearance for appellee.
HARSHBARGER, Justice:
The Dishmans appeal the Wayne County Circuit Court's dismissal of their complaint for failure to state a claim upon which relief can be granted, West Virginia Rules of Civil Procedure, 12(b)(6).
Their complaint alleges that they bought 1.85 acres of real estate for $12,600 on November 6, 1972, and executed a deed of trust to Wayne County Bank for $4,550-that trust deed is now owned by Clifford Hatten. In late 1974 or early 1975, plaintiffs borrowed $1,000 at 6% interest from Jarrell, secured by a conveyance of the real estate by a deed dated February 17, 1975. They remained in possession of their property and made payments of $54.02 a month to Jarrell, who in turn paid Hatten. Plaintiffs missed certain payments and Jarrell brought an unlawful entry and detainer proceeding in magistrate court to evict them from the property. (The Dishmans did not answer or appear in the suit.) There was no valuable consideration for the conveyance, and they are willing and able to pay the amount they owe. They sought an injunction, adjudication of money due, and to compel defendant to reconvey the property to them.
Our rule about Rule 12(b)(6) is in John W. Lodge Dist. Co., Inc. v. Texaco, Inc., W.Va., 245 S.E.2d 157 (1978), Syllabus:
`The trial court, in appraising the sufficiency of a complaint on a Rule 12(b)(6) motion, should not dismiss the complaint unless it appears beyond doubt that the plaintiff can prove no set of facts in support of his claim which would entitle him to relief.' (Citations omitted.)
The rules of pleading are liberal and seek substantial justice. Rules 1, 8(a) and (f), R.C.P.
We therefore must match the complaint to substantive law.
A deed, absolute on its face, can be declared a mortgage, and the right to redeem may be established by parol evidence. Ross v. Midelburg, 129 W.Va. 851, 42 S.E.2d 185 (1947); Dudley v. Buckley, 68 W.Va. 630, 70 S.E. 376 (1911); Fridley v. Somerville, 60 W.Va. 272, 54 S.E. 502 (1906). A court considers several factors, including the intention of the parties, Law v. Meadows, 131 W.Va. 132, 46 S.E.2d 449 (1948), Hursey v. Hursey, 56 W.Va. 148, 49 S.E. 367 (1904); the existence of a debt to be secured, Bobbitt v. Bobbitt, 130 W.Va. 173, 43 S.E.2d 65 (1947), Holmes v. Basham, 130 W.Va. 743, 45 S.E.2d 252 (1948); the circumstances under which the conveyance *350 was made, Sadler v. Taylor, 49 W.Va. 104, 38 S.E. 583 (1901); whether the grantor remained in possession, Hoffman v. Ryan, 21 W.Va. 415 (1883); and inadequacy of price, Gilchrist v. Beswick, 33 W.Va. 168 (1889), Davis v. Demming, 12 W.Va. 246 (1877). Plaintiffs have alleged a debt to be secured, intent of parties, inadequacy of price and that they remained in possession, facts sufficient to tend to establish an equitable mortgage.
In addition, they have stated sufficient facts to prohibit further unlawful detainer proceedings, because a magistrate cannot try real estate titles, Code, 51-2-2 and 50-2-1.
In Ford v. Ball, 76 W.Va. 663, 86 S.E. 562 (1915), Syllabus Point 5, we ruled:
A justice of the peace [now magistrate] is not required to determine whether a question of title will collaterally arise in an action of which he would have full jurisdiction but for such question, if the objecting party does not file an affidavit setting forth facts showing such question will arise.
But if at any time a magistrate determines that an action is outside his jurisdiction, he shall dismiss without prejudice. Code, 50-4-11. Subject matter jurisdiction may never be waived. W. Va. Secondary School Activities Commission v. Wagner, 143 W.Va. 508, 102 S.E.2d 901 (1958).
A judgment which was not set aside, vacated or appealed from may be attacked collaterally in an independent procedure if extraneous matters are relied upon as a basis for relief. Belcher v. Tolliver, 111 W.Va. 78, 160 S.E. 567, 568 (1931); Star Piano Co. v. Burgner, 89 W.Va. 475, 109 S.E. 491 (1921). When there was a distinction between law and equity courts, defenses related to equitable title were not cognizable in an unlawful detainer action and were heard in an independent proceeding. Frum v. Prickett, 71 W.Va. 273, 76 S.E. 453 (1918). Accord Ludington v. Tiffany, 6 W.Va. 11 (1813). Although the law/equity distinction has been abolished, the principles underlying the actions are the same, see 11A Michie's Jurisprudence, Judgments and Decrees § 129, et seq., and an action to enjoin enforcement of judgment based on equitable title is effective to challenge a magistrate's jurisdiction to hear the purported unlawful detainer action. See Reynolds v. Board of Education of Malden Dist., 93 W.Va. 540, 117 S.E. 228 (1923); Brotherton v. Robinson, 85 W.Va. 753, 102 S.E. 700 (1920); Hughes v. Mount, 23 W.Va. 130 (1883).
The Dishmans did not put title in issue at the magistrate level by answer or otherwise; instead they sued in circuit court to enjoin enforcement of the judgment. By either method, the complaint's allegations, if proved, are sufficient to oust the magistrate of jurisdiction. See generally Annotation, When title to real property deemed involved within contemplation of statute providing that justice of the peace (or similar court) shall not have jurisdiction of matters relating to title to land, 115 A.L.R. 504 (1938 and supps.), § 3. His lack of jurisdiction, whenever discovered, voids his ruling ab initio. See Rakes v. Ferguson, 147 W.Va. 660, 130 S.E.2d 102 (1963); Cobb v. Cobb, 145 W.Va. 107, 113 S.E.2d 193 (1960); Stephenson v. Ashburn, 137 W.Va. 141, 70 S.E.2d 585, 587 (1952).[*]
The statute of frauds does not affect the Dishmans' suit because our rule is that it is no bar to proof of an equitable mortgage.
As we view the authorities, the law relating to the creation of equitable mortgages is in no wise affected by the statute *351 of frauds, as they were first enacted in England, or as they have been recognized and reenacted in Virginia and in this State. The right of a debtor to show that a conveyance of land made by him, absolute on its face, was in fact a mortgage, has always been recognized, and it is likewise recognized that such showing may be made by parol evidence, or the facts and circumstances surrounding the transaction. Law v. Meadows, supra 131 W.Va., at 140, 46 S.E.2d, at 453.
We reverse the trial court's 12(b)(6) dismissal, stay enforcement of the magistrate's eviction order pending trial in circuit court on title to the realty, and remand for further proceedings on the merits.
Reversed and remanded.
NOTES
[*]  If the unlawful detainer judgment had been appealed to circuit court, the case would have been heard de novo and the magistrate's judgment annulled. Staats v. McCarty, 130 W.Va. 240, 246, 43 S.E.2d 826 (1947); Taylor v. Campbell, Cooper & Co., 77 W.Va. 347, 87 S.E. 377 (1915).
