The general rule in a court of equity is, that all persons having a material interest, legal or equitable, in the subject matter of a suit, must be made parties, either as plaintiffs or defendants. The rule proceeds on the principle that no man’s rights should be controverted in a coxxrt of justice, unless he has full opportunity to appear and vindicate them; and further, that complete justice may be ■done and' future litigation avoided, the performance of the *31-decree being safe, because of the presence in court of all who have an interest in its subject matter. — Story’s Eq. PI. § 72.
A mortgage operates in a court of law as a conveyance, transferring to the mortgagee the estate of the mortgagor. In equity, it is a mere security for a debt; and until its foreclosure, by decree of a court of equity, or by the execution of a power of sale, if such power is conferred, the mortgagor may redeem by payment of the debt. An assignment of the mortgage debt, not being otherwise expressed, will in a court of equity be deemed an assignment of the ■mortgage. The assignee is entitled to foreclose it — the debt being regarded as the principal, and the mortgage as an incident to it.—Emanuel & Gaines v. Hunt, 2 Ala. 190; Center v. P. & M. Bank, 22 Ala. 243. An assignment of the debt, without an assignment of the mortgage, will not at law pass the legal estate of the mortgagee. That remains in him, clothed with a trust for the benefit of the assignee. Welsh v. Phillips, 54 Ala.
If the mortgagee assigns absolutely the debt and the mortgage, he thereby parts with all interest, and is not a necessary party to a bill for foreclosure, filed by the assignee. Whitney v. McKinney, 7 Johns. Ch. 144. The assignment of the debt only, though an equitable assignment of the •mortgage, not passing the estate of the mortgagee, he is, we-think, an indespensable party to a bill by the assignee for a foreclosure. A decree of foreclosure is in this State uniformly accompanied with a decree for the sale of the mortgaged premises. In this case, the decree rendered is one of sale merely, and such has grown to be the usual practice. The court should not order a sale of an imperfect title — one which it is apparent may involve the purchaser in future litigation. A purchaser under the present decree would not acquire the legal estate of the mortgagee. Though he has assigned the mortgage debt, and that in equity passes the mortgage, as it would pass any other security for the debt, such is its effect and operation in a court of equity only. A court of law may, if the assignee was proceeding therein by ejectment, in the name of the mortgagee, to recover the premises, notice and protect the equity the assignment cre.ates, and refuse to permit the mortgagor by interference with the suit to defeat it, as it often notices equities for purposes ■of protection.—Roden v. Murphy, 10 Ala. 804. Yet, the legal estate remains in the mortgagee, and if, after a sale, -under a decree to which he was not a party, he should assert *32at law this estate, the purchaser would be driven into equity for protection, and for the enforcement of the equity, the assignment of the debt created'. The decree, in the absence of the mortgage, does not operate on the legal estate, and preclude future litigation. The purchaser cannot with safety repose on it as the muniment of a perfect title.—Gliddon v. Andrews, 10 Ala. 166.
The general rule is, that if a bill is defective for the want of proper parties, advantage should be taken of the defect, by plea, demurrer, or answer, and if not so taken, the objection is waived. The rule is subject to the exception, that if the cause can not be properly disposed of, on the merits, without the presence of the absent parties, the objection may be made at the hearing, or on error, it may be taken by the court ex mero motu.—McMaken v. McMaken, 18 Ala. 576; Goodman v. Benham, 16 Ala. 625; Woodward v. Wood, 19 Ala. 213. ¥e can not doubt the mortgagee, Kelly, was a necessary party to this bill, and that in his absence a decree could not be rendered binding the legal estate, and quieting future litigation. This error is vital, and must reverse the decree, although objection was not made in the court of chancery. Otherwise, a practice would be sanctioned violating the fundamental principles of equity, and which would provoke rather than terminate litigation.
The original agreement for the purchase of the premises, provided for a conveyance to the wife, on the payment in full by her of the purchase money. This agreement certainly created in the wife an equity. It appears the husband asssented to the agreement. This equity of the wife was her statutory separate estate, incapable of alienation, except in the mode prescribed by the statute. It may be true, as insisted by the counsel for the appellants, that the inhibition of the statute, “ husband and wife can not contract with each other for the sale of any property,” extends to this equity, and that by no contract between her and her husband could it have been converted into a joint estate. The mortgage, nevertheless, operates as a security for the payment of the purchase money, and transfers the equity the original’ agreement created. If the wife should pay the purchase money, the deed conveying the premises to her and the husband jointly, would not bar her right to a specific performance of the original agreement of purchase, and a conveyance to her separately, of the legal estate. It does not seem that the execution of the conveyance to husband and wife, jointly, was intended to deprive the wife of the equity the original agreement *33created, and to create in the husband an interest that agreement did not create. That such is its effect is probably due to mere misapprehension. The purpose was to render the security for the payment of the purchase money more available to the vendor and more capable of enforcement. Without regard to this conveyance, the mortgage attaches to whatever interest the wife acquired by the purchase, and so far as it operates on that interest is valid, subject to foreclosure.—Marks v. Cowles, 53 Ala. 499.
For the omission of Kelley, the mortgagee, as a party, the decree must be reversed and the cause remanded. The appellants not having made this objection, in the court of chancery, are in fault, and must pay one-half the costs of this appeal, and the appellee the remainder.