
398 So.2d 258 (1981)
The FIRST NATIONAL BANK OF MOBILE
v.
GILBERT IMPORTED HARDWOODS, INC.
80-20.
Supreme Court of Alabama.
April 24, 1981.
*259 Mary Elizabeth McFadden of McFadden, Riley & Parker, Mobile, for appellant.
Irvin J. Langford and George W. Finkbohner, Jr. of Howell, Johnston, Langford, Finkbohner & Lawler, Mobile, for appellee.
BEATTY, Justice.
Appeal from a judgment of dismissal in favor of the defendant, Gilbert Imported Hardwoods, Inc. (Gilbert). We reverse and remand.
The action began with a complaint for a declaratory judgment filed by The First National Bank of Mobile (First National) praying that the circuit court acknowledge plaintiff-bank as the priority lienholder with respect to a certain lot of land located in Mobile County. According to the complaint, Leslie and Jessie Sims conveyed the lot to Gayle Roberts by deed dated August 2, 1978, reserving a vendor's lien. Then on January 26, 1979 Roberts and his wife executed a mortgage on the property to Commercial Guaranty Bank of Mobile. Later that year, on December 10, 1979, the Robertses executed another mortgage on this same property to First National.
On March 24, 1980 the Robertses conveyed the property by deed to Gilbert. On that same date Gilbert took an assignment of their vendor's lien from the Simses. An assignment of the mortgage held by Commercial Guaranty was made by Commercial to Gilbert on April 23, 1980. The effect of these transactions, alleged the plaintiff, merged the legal and equitable titles in the defendant, Gilbert, with First National's mortgage lien being elevated to priority lienholder status. The plaintiff alleged further an imminent foreclosure of the Commercial Guaranty mortgage by the assignee, Gilbert, when that lien had been extinguished by merger, and when there was no basis for a foreclosure because the only remaining mortgage lien, the Robertses' mortgage to First National, was not in default.
The defendant, Gilbert, moved to dismiss the complaint, inter alia, for failure to state *260 a claim on which relief could be granted. This motion was granted.
The plaintiff moved for a reconsideration of the judgment of dismissal, alleging that it could prove that the consideration for the deed from the Robertses to Gilbert was the satisfaction of the Simses' vendor's lien, the Commercial Guaranty mortgage lien, and the plaintiff's mortgage lien, but that instead of satisfying those liens the defendant took assignments of the first two but failed to satisfy that of the plaintiff. Thus the plaintiff contended that dismissal was not appropriate because of the intent of the parties (apparently the Simses, the Robertses and Gilbert). The motion for a reconsideration was also denied, and this appeal followed.
Whether the motion to dismiss was properly granted depends in the first instance upon the effect of the deed and assignments to Gilbert.
With regard to mortgages, Alabama is a "title" state, i. e., upon the execution of the mortgage legal title passes to the mortgagee. See Trauner v. Lowrey, Ala., 369 So.2d 531, 534 (1979) and cases cited. The mortgagor retains an equity of redemption which he may convey. McDuffie v. Faulk, 214 Ala. 221, 107 So. 61 (1926). Under these principles, when the Robertses executed the mortgage of January 26, 1979, Commercial Guaranty took legal title to this lot of land as security for the mortgage debt, with the Robertses retaining an equity of redemption only. The subsequent assignment of this mortgage by Commercial vested that legal title in Gilbert. The Robertses' intervening deed to Gilbert on April 23, 1980, together with the Simses' assignment of their vendor's lien to Gilbert on the same date, vested all legal and equitable interests in Gilbert, subject to the Robertses' mortgage to First National. What was the effect of these transfers on the Commercial Guaranty mortgage?
According to the plaintiff, the effect was to extinguish the debt represented by the Commercial Guaranty mortgage, leaving the First National mortgage as the sole mortgage obligation. In any event, the plaintiff states, whether that result follows is a question of intention.
Tiffany, Law of Real Property, Vol. 5, § 1497 at 504 comments upon the effect of the acquisition of the mortgaged land and the mortgage debt:
As we have before seen, the debt is the principal thing, and the mortgage is merely an incident, and the question is, not whether the mortgage is merged, but whether the acquisition by one person of both the mortgaged land and the debt secured by the mortgage has the effect of extinguishing or merging the debt. If the debt is extinguished under such circumstances, the mortgage lien is necessarily also extinguished, while if the debt remains the mortgage lien also remains. Even in states which adhere to the title theory of a mortgage, the mere acquisition, by the owner of the land, of the legal title of the mortgagee, without the debt, could not extinguish the debt, nor affect the creditor's right to proceed against the land in equity, while, on the other hand, if the owner of the land acquires the debt, with its incidental lien, the fact that he does not acquire the legal title, this being still outstanding in the mortgagee, could not, it is conceived, prevent the debt and the lien being extinguished, if the owner of the debt and of the land so intended and desired.
And he added at 505:
In case the owner of the mortgaged land, whether the original mortgagor or his transferee, conveys the land to the mortgagee creditor under an agreement that this shall operate to extinguish the mortgage debt, such conveyance ordinarily extinguishes the lien of the mortgage. In that case the extinguishment of the debt and its attendant security is properly by way of payment or accord and satisfaction, but the courts usually refer to it as a case of merger....
Tiffany, § 1480 at 506 continues:
The theory on which, upon the acquisition by one person of the mortgaged land and of the mortgage debt with the incidental *261 lien on the land, the debt, and with it the lien, may ordinarily be regarded as extinguished, would seem to be that, under such circumstances, the person owning and controlling the debt can usually have no object in keeping it alive, it being in substance a claim against his own property, and he may consequently be presumed to intend that the debt shall be extinguished, a presumption to which, as tending to the simplification of titles, the courts are ready to give full effect. In accordance with this view are the numerous decisions that the intention of the holder of the two interests is the decisive consideration, and that no merger will take place if there is proof of an intention on his part to the contrary.
The doctrine of merger is recognized in Alabama. The general principle was recited with approval in Barnett & Jackson v. McMillan, 176 Ala. 430, 58 So. 400, 401 (1912):
"[W]hen the legal title becomes united with the equitable title, so that the owner has the whole title, the mortgage is merged by the unity of possession." [Citations omitted.]
. . . .
["]The rule also applies to a grantee of the mortgagor who takes a conveyance of the land, subject to the mortgage, and expressly assumes and promises to pay it as part of the consideration. * * * If he pays off the mortgage, it is extinguished." [Citations omitted.]
The case of A. M. Robinson Co. v. Anniston Land Co., 217 Ala. 648, 117 So. 29 (1928) is in accord:
[O]ne, having a mortgage on real estate, becoming the owner of the fee, ordinarily the result is a merger; yet it is a qualification thereof (1) if the intention of the parties was to keep alive the mortgage, or (2) if it is to the interest of the mortgagee to do this, or (3) necessary to his protection, and (4) this can be done without prejudice to the rights of the mortgagor or third parties as between such original parties the doctrine of merger will not apply. [Citations omitted.]
In that case and in Stewart v. Stephenson, 243 Ala. 329, 10 So.2d 159 (1942), this Court did not apply the doctrine of merger, in the former because of a deficiency in the pleadings, and in the latter because of the wording of the agreement between the mortgagor and the mortgagees, consistent with the noted exceptions. See also Ehrman v. Alabama Mineral Land Co., 109 Ala. 478, 20 So. 112, 114 (1896):
A mere purchase by a mortgagee, or by the transferee of a mortgagee, of the mortgaged property does not necessarily produce a merger and an extinguishment of the mortgage lien. Under some circumstances it may be necessary to preserve the mortgage lien as a protection against the intervening liens. But the rule is different where there is an assignment of the mortgage to the grantee of a mortgagor who assumed to pay the mortgage debt. Under such circumstances the merger is complete, and the mortgage lien is extinguished....
It should be noted that this review is based upon the grant of a motion to dismiss and the denial of a motion for reconsideration of that decision. In that posture, the allegations of the complaint must be construed in a light most favorable to the plaintiff, with all doubts and allegations resolved in his favor, and a complaint should not be dismissed for failure to state a claim unless it appears beyond doubt that the plaintiff could prove no set of facts in support of his claim which would entitle him to relief. Dunson v. Friedlander Realty, Ala., 369 So.2d 792 (1979). Under the allegations of this complaint the plaintiff could prove that by virtue of the transactions between the grantors-mortgagors Roberts, the assignors Sims, the assignor Commercial Guaranty, and the grantee-assignee Gilbert, it was the intention of the parties that a merger take place which would have extinguished the mortgage indebtedness of Roberts to Commercial Guaranty, giving the First National mortgage priority. Additionally, the plaintiff might prove no basis for the foreclosure proceeding alleged.
*262 We conclude, therefore, that it was error to grant the motion to dismiss and to deny the motion for a reconsideration. The judgment, accordingly, must be reversed and remanded, and it is so ordered.
REVERSED AND REMANDED.
TORBERT, C. J., and MADDOX, JONES and SHORES, JJ., concur.
