#### LEWIS DAVIS, Respondent, *v.*JOSEPH DAVIS AND BENNETT PRICE, Appellants.

*Pleading*— Counter-claim—Attorney *in fact.*— Defendant, Joseph Davis, who was the attorney in fact of the plaintiff, conveyed hy virtue of such agency certain property belonging to the plaintiff to his co-defendant, who in turn reconveyed it to the defendant. In an action to annul the conveyances the defendant pleaded as a separate defense that the premises in controversy were purchased by the plaintiff, defendant, and another; that defendant supplied the money to pay for his share; that the deed was taken in the name of the plaintiff alone; that at the time of and prior to the acts complained of, the legal title to such share was in the plaintiff, but that there was a resulting trust in favor of the defendant, and that defendant had an equitable title to said share in the premises when the power of attorney was made to him. *Held,*that this defense was a good original cause of action in defendant’s favor against the plaintiff if defendant sought a reconveyance of that share from the plaintiff, and was properly set up in the answer under the provisions of sections 89 and 90, chapter 4, Code of Civil Procedure. *Held, also,*that the acceptance by the defendant of the power of attorney, and his actions under it, did not deprive him of this cause of action, whether *set*up in an original action, or as an equitable defense in the case at bar against the plaintiff. *Qucere,*under section 91, chapter 4, Code of Civil Procedure, must he not set it up or be afterwards barred from asserting it?

*268Estoppel — *Conveyance by attorney in fact to himself.*— An attorney in fact, who, by advantage of his agency, conveys the legal title of the land of his principal to himself, is not thereby estopped from asserting a prior equitable title in himself in an action by the principal to annul the conveyance.

Prater not *Conclusive*— Equity *pleading.*— Where the defendant pleads new matter in the answer as a defense, praying to be discharged, he is not concluded thereby from obtaining such relief as he shows himself entitled to. (Oases of *Gidettr. Clark,*6 Mont, 191; *Leopold*y. *Silverman,*7 Mont. 266, cited.)

*Appeal from, First Judicial District, Lewis and Clarice County,*

Plaintiff’s motion for judgment on the pleadings was sustained by Blake, C. J.

*Massena Bullard,*and *Carpenter, Buck & Hunt,*for Appellants.

Where, upon foreclosure of property, title is taken in the name of one, but the consideration is paid by another, a resulting trust arises. (Perry on Trusts, § 126; Story on Equity Jurisprudence, § 1201.) If a joint purchase is made in the name of one, and another pays his share of the purchase money, the latter will be entitled to his share of the property as a resulting trust. (Story on Equity Jurisprudence, § 1206; *Buck*v. *Swazey,*35 Me. 49; 56 Am. Dec. 681; Wood on Statute of Frauds, § 456; *Edwards*v. *Edwards,*39 Pa. St. 369.) Where part of the purchase price is paid by one, and the title is taken in the name of another, there is a resulting trust *pro tanto.*(4 Kent Com. 306; *Lonebury*v. *Purdy,*18 N. Y. 515; *Sayre*v. *Town-sends,*15 Wend. 647; *Learned*v. *Haley,*34 Cal. 608.) A trust results when laud is purchased by one brother in the name of another. (Hill on Trustees, p. 98; Perry on Trusts, § 144.)

A court of equity will not set aside the deeds, if Joseph Davis was the owner of the property, or if plaintiff held the property in trust for him. There was a consideration for the deeds when the money was paid by Joseph Davis and the title taken in plaintiff. The court should not set aside the deeds unless equity is done by plaintiff It is the duty of plaintiff to convey the trust property. (Story on Equity Jurisprudence, § 693; Willard’s Equity Jurisprudence, § 302.) A void deed will not be set aside by a court of equity unless equity is done by the party seeking a cancellation. *(Canfield*v. *Fairbanks,*63 Barb. 461.) The deeds sought to be canceled are not absolutely *269void. *(Hunt*v. *Johnson,*44 N. Y. 27; 4 Am. Rep. 631.) All of the facts necessary to constitute a defense, and to entitle the defendant, Joseph Davis, to equitable relief, are set forth in the answer; and if these facts are true a court of equity should not direct the cancellation of the deeds, but on the contrary should render a decree establishing the defendant’s title against the plaintiff.

*Cullen & Sanders,*for Respondent.

Where an agent, holding a power of attorney to sell, becomes the purchaser himself, the sale will be set aside on the application of the principal. An agent, by accepting a power of attorney to sell real estate, is thereby estopped from denying the title of his principal. (2 Pomeroy’s Equity Jurisprudence, § 559, and notes; *jReese*v. *Medloeh,*27 Tex. 120; 84 Am. Dec. 611-614, and notes; *Frinlc*v. *Roe,*70 Cal. 296; 2 Herman on Estoppel, §§ 887-890; *Willison*v. *Watkins,*3 Peters, 43-48; *Morrell*v. *Cone,*22 How. 75; *Mott*v. *Smith,*16 Cal. 536-557; *Borell*v. *Rollins,*33 Cal. 409; *Trudo*v. *Anderson,*10 Mich. 357; 81 Am. Dec. 795; Mecliem on Agency, § 326; *Meade*v. *Brothers,*28 Wis. 689-693; *Miehoud*v. *Girod,*4 How. 503, 553.) It is admitted by the pleadings in this case that the appellant accepted the trust created by the power of attorney given him by the respondent; that, without consideration, and for-the sole purpose of having the property mentioned in the complaint conveyed to him, he conveyed it to one Bennett Price, who in turn reconveyed it without any consideration to the appellant. It is manifest that the appellant is in no better position than if he, as the attorney in fact of Lewis Davis, had assumed to convey it directly to himself. *(Bain*v. *Brown,*56 N. Y. 288; 1 Story on Equity Jurisprudence, § 316, and cases there cited; *Case*v. *Carroll,*34 N. Y. 388; *Hill*v. *Frazier,*22 Pa. St. 320; *Smeltzer*v. *Lombard,*57 Iowa, 294; *Gilman do. R. R. Co.*v. *Kelly,*77 Ill. 426; *Davis*v. *Hamlin,*108 Ill. 39; *Greenfield Sav. Bank*v. *Simons,*133 Mass. 415; *Reckham Iron Co.*v. *Harper,*41 Ohio St. 100.) In *Wilbur*v. *Lynde,*49 Cal. 290, it is held that such a contract is contrary to public policy and void for that reason. The admissions made by the answer show that the deeds which *270passed between Joseph Davis and Bennett Price were void. The whole object of the action is to have them so declared, and when that fact appears from the pleadings the court will not stop to inquire what are the equities between them. *(McKay*v. *Williams>*67 Mich. 547; 11 Am. St. B.ep. 597.)

Brief of appellants in reply.

The court will inquire into the equities between the parties, in any action in which the defense is connected with the subject-matter set forth in the complaint. (1 Pomeroy’s Equity Jurisprudence, §§ 84, 85, 86; *Orary*v. *Goodman,*12 N. Y. 266; *Dobson*v. *Pearce,*12 N. Y. 156; *Burc/ett*v. *Bissell,*5 How. Pr. 192; *Bruck*v. *Tucker,*42 Cal. 346; *Gates*v. *Salmon,*44 Cal. 382.) A court of equity will deny relief to any one without clean hands, or not doing equity. (1 Pomeroy’s Equity Jurisprudence, 385, 392, et seq.; *Crealh’s Adm’r*v. *Sims,*5 How. 204; *Livingston*v. *Harris,*3 Paige, 528, 537; *Fanning*v. *Dunham,*5 Johns. Ch. 122; *Mumford*v. *American etc. Ins. Co.*4 N. Y. 453; *Comstock*v. *Johnston,*46 N. Y. 615; *Guttenberger*v. *Woods,*51 Cal. 523; *Pujol*v. *McKinlay,*42 Cal. 560; *Evans*v. *Folsom,*5 Minn. 432; *Dugan*v. *Colville,*8 Tex. 126.) It is not claimed by respondent that said Joseph Davis has acquired title to an inch of land that belongs to Lewis Davis or any other person. Simply an exploded technical legal doctrine is sought to be interposed to defeat a substantial right. No similar case can be found under code practice where an equitable defense has been excluded. Equity rejects any and every legal estoppel that prevents an ascertainment of the truth. (Perry on Trusts, § 416.) Equity does not relieve against fraud from which no damage results. *(Jewett*v. *Davis,*10 Allen, 68.) It. would be inequitable and unjust to require the appellant to bring another action to enforce rights that may be properly adjudicated in the action now before this court.

De Witt, J.

The complaint alleges that on the first day of December, 1882, plaintiff, being about to leave Montana, gave to the defendant, Joseph Davis, a power of attorney, authorizing him to sell and convey the real estate of plaintiff in Lewis and Clarke County, said Territory. The plaintiff was then the *271owner of several described tracts of real estate in said county. The power of attorney was duly recorded February 2, 1885. On February 20,1885, the defendant, contriving to cheat plaintiff, and without consideration, conveyed said premises by two deeds to defendant, Bennett Price. Those deeds were executed, “Lewis Davis, by Joseph Davis, his attorney in fact.” They were acknowledged and recorded. That, in furtherance of defendant’s purpose to defraud plaintiff, said Price, on February 21, 1885, without consideration, conveyed said premises to Joseph Davis. The deeds are all pleaded in the complaint. That said transactions between Joseph Davis and Price were •fraudulent and void. Plaintiff prays that all said deeds be declared void, and that the title to the premises be adjudged to be in the plaintiff.

The answer contains some denials, which we need not consider in this decision. It then sets forth a separate defense, separately stated, which may be substantially stated, with the legal effect claimed, as follows: That the premises in controversy, or so much thereof as is necessary to notice in this consideration, were originally purchased by Lewis Davis, Joseph Davis, and another. That Joseph supplied the money to pay for his share in the same. That the deed was taken in the name of Lewis alone. That consequently, at the time of and prior to the acts complained of in the complaint, the legal title was in Lewis, but that there was a resulting trust created in favor of Joseph, and that Joseph had an equitable title in the premises when the power of attorney was made to him, and when he made the transfers complained of. It appears that Joseph, by the circumambulation through Bennett Price, as attorney in fact for Lewis, conveyed to himself, Joseph, the premises, in which, as appears by his answer, he claims he had the equitable title by virtue of the resulting trust suggested.

There was no replication. Plaintiff moved for judgment on the pleadings, “for the reason that the answer filed by the defendants does not present any sufficient defense to the cause of action set up in the plaintiff’s complaint.” The motion was granted, and judgment entered accordingly. From that judgment this appeal is taken.

We are to determine whether the new matter in the answer *272constituted a defense which could be presented in this action. The complaint is in equity. The new matter, if it be a defense, is an equitable one. For the purposes of this decision, we take the new matter as true, and, for convenience of treatment, will hereinafter speak of it as facts, and not merely allegations. Joseph Davis, by the power of attorney, was constituted the agent of Lewis Davis. He was in a fiduciary relation. Before the power of attorney was given, the legal title being in Lewis and the resulting trust existing, and the equitable title being in Joseph, Lewis was in a fiduciary capacity as to Joseph.

We will not cite authorities upon the general rule of equity, that an agent shall not unite his personal and representative capacities in the same transaction; that he shall not deal with himself; that an agent to sell for his principal shall not himself become the buyer, directly or indirectly; that an agent to buy for his principal shall not himself be the seller. These general doctrines are as old as the court of chancery. •

Respondent urges that the conveyances from Joseph, agent, to Joseph personally (for the mediation of Bennett Price is not material), must be set aside under the equitable rules cited. The lower court so held, and on that view gave judgment. The opinion on file bases the decision upon those doctrines.

We are of opinion, however, that there is another step in the case, another view of the situation of the parties as being in a court of equity, to which the attention of the District Court was not invited, and the opinion of that court does not treat of the subject which we will now discuss. Chapter 4, Code of Civil Procedure, provides: “Sec. 89. The answer of the defendant shall contain: .... *Second,*a statement of any new matter constituting a defense or counter-claim. .... Sec. 90. The counter-claim mentioned in the last section shall be one existing in favor of the defendant or plaintiff, and against a plaintiff or defendant, between whom a several judgment might be had in the action arising out of one of the following causes of action: *First,*a cause of action arising out of the transaction set forth in the complaint or answer as the foundation of the plaintiff’s claim or defendant’s defense, or connected with the subject of the'action. ; . . . Sec. 91. If the defendant omit to set up a counter-claim in the cases mentioned in the first subdivision of the last section, *273neither he nor his assignee can afterwards maintain an action against the plaintiff therefor.The defendant may set forth, by answer, as many defenses and counter-claims as he may have,” etc.

Was defendant’s new matter a defense or counter-claim, and, if so, under the provisions of the Code of Civil Procedure, *supra,*and by the rules of equity practice, may it be set up in the answer in the case? If so, judgment should not have been against the defendant on the pleadings, and the case should go back to the District Court for a determination of the equities. The subject suggests the following order of discussion:—

1. Is the new matter in the answer such that, if it were set forth in an original complaint in an action in equity, it would be entertained as entitling defendant to relief in such court That is to say, if a plaintiff' in a bill in equity allege that he furnished money to defendant to purchase land for him, that defendant purchased the land with the money, and took a deed to himself alone, either with or without plaintiff’s consent, do these facts entitle plaintiff to equitable relief? The authorities are uniform that they do. (Perry on Trusts, ch. 5; Story on Equity Jurisprudence, §§ 1201, 1206; *Buck*v. *Swazey,*35 Me. 41; 56 Am. Dec. 681; Wood on Statute of Frauds, § 456; *Edwards*v. *Edwards,*39 Pa. St. 369.) The defendant’s new matter is a good original cause of action in his favor against the plaintiff.

2. The defendant, Joseph Davis, having such original cause of action before the power of attorney was given to him by plaintiff, Lewis Davis, does the execution by Lewis Davis of such power of attorney deprive Joseph of his cause of action described? In other words, if such cause of action was put into a complaint by Joseph against Lewis, could Lewis defend by alleging the giving of the said power of attorney? It is *reductio ad absurdum.*The question answers itself in the negative.

3. Again, did the acceptance by Joseph of said power of attorney deprive him of such above-described cause of action ? Because he consented to act for Lewis as his agent in the caring for and disposition of the lands of Lewis, and also the lands of which the legal title was in Lewis and the equitable one in Joseph, does this consent, this acceptance of an agency, debar *274Joseph from demanding in a proper action and court rights which existed and were undisputed before the agency was created? Joseph Davis, having the cause of action set forth in paragraph 1, *supra,*could not be cut out of it by accepting the agency conferred by the power of attorney by any principle of law of which we are aware.

4. Again, after the power of attorney was given by Lewis and accepted by Joseph, did Joseph’s acts, under the power of attorney complained of in the complaint herein, deprive him of his cause of action above described? Counsel for respondent quote the equity maxims, “ He who seeks equity must do equity; ’.’ “He who comes into a court of equity must come with clean hands;” and argues that, because Joseph Davis took his own land and kept it, when it came into his own hands, by virtue of the creation of the agency by the power of attorney, he cannot be heard to assert his equitable right thereto at this time.

We must distinguish here between the state of facts in the case at bar and another one that might exist. Joseph obtained the power of attorney rightfully. It was the voluntary act of Lewis. The *fiduoium*was mutual. Lewis held Joseph’s title in trust for him. Joseph took Lewis’ power of attorney as a trust. On the other hand, if Joseph had obtained such power of attorney wrongfully — to illustrate it strongly, by actual violence, or duress *per minas*— and, after it were so obtained, by the authority thereof had conveyed the land to himself, and then had acquired an equitable title thereto, a court of equity would hesitate to hear him, and might then apply the maxim, “He who comes into a court of equity must come with clean hands.”

But the only proposition before us is, when Joseph was given by Lewis dominion over the land belonging to Lewis in law, and to Joseph in equity, and Joseph undertook, by the advantage of his agency to procure to himself the legal title, when he already held the equitable one, was that attempt of such a nature that the law visits the penalty of estopping Joseph from after-wards asserting that equitable title? The question is not now whether that attempt succeeded from a legal point of view, or whether Joseph obtained the legal title by his maneuvers, but whether he lias so conducted himself that he has lost his equity. The result could only occur through the operation of the rules *275of estoppel. Those rules are too familiar to require recitation. It is clear that their application to the facts under discussion cannot work an estoppel against Joseph Davis. (See Perry on Trusts, § 416.)

5. We therefore arrive at the conclusion that, prior to the time when the obnoxious deeds were made, an affirmative cause of action existed in favor of Joseph and against Lewis as above fully described, and that when the action was commenced Joseph had not lost the right to set. up that cause of action, and that the facts constituting the same are pleaded as new matter in the answer.

6. Such new matter would constitute a defense or counterclaim. (Code Civ. Proc. §§ 89, 90.) Defendant alleges it in the form of a defense. The prayer of the answer is that defendant be discharged. But the prayer in an equity action does not conclude the pleader. *(Gillett*v. *Clark,*6 Mont. 191; *Leopold*v. *Silverman,*7 Mont. 266.) The court may grant such relief as the party shows himself entitled to. The allegations in the new matter are sufficient for a counter-claim, on which the court could enter a decree adjudging the title to be in Joseph Davis, if it were deemed that the dismissal of the action, as prayed for in the answer, were not a sufficient confirmation of defendant’s title.

7. Such new matter is “connected with the subject of the action.” It is inseparably connected with the question of the title to the premises. The title to the premises is the subject of the action.

8. Defendant may set up such new matter in his answer. (Code Civ. Proc. §§ 89, 90.)

9. *Quaere,*must he not set it up, or be afterwards barred from asserting it? (Code Civ. Proc. § 91.)

10. Under the rules of practice in a court of equity, the court will hear an equitable defense or counter-claim, connected with the subject-matter of the petition, without regard to the provisions of the Code of Civil Procedure above cited. (1 Pomeroy’s Equity Jurisprudence, § 84, et seq.; *Crary*v. *Goodman,*12 N. Y. 266; *Dobson*v. *Pearce,*12 N. Y. 156; *Bruck*v. *Tucker,*42 Cal. 346.)

11. It is a settled rule of equity practice that when the court *276bas before it all the parties to any difference, and when it has obtained complete jurisdiction of the whole subject-matter, it will finally settle the whole controversy. “The court may, on a view of the whole case, annex equitable conditions to its decree, or order what may be reasonable.” *(Polk’s Lessee*v. *Wendal,*9 Cranch, 87.) The court, in the case before us, has, with the new matter in the answer, the ample purview contemplated by the rules of equity. It has the whole controversy and all the parties before it. Final adjudication of all the claims of Lewis Davis and Joseph Davis in the premises may be and should be made in one decree, *ut sit finis litium.*The judgment of the District Court, so far as it affects the validity of the deeds from Joseph Davis, as attorney in fact to Bennett Price, and the deeds from Bennett Price to Joseph Davis, is affirmed; but the cause is remanded, with directions to the District Court to entertain the equitable claim of defendant set up in his answer, and to hear and determine the claims of the parties in and to the premises in controversy.

Harwood, J., concurs.

Blake, C. J., did not sit in the case, having been trial judge in the court below.