This motion I deemed it proper to grant on the hearing for reasons then orally expressed ; but the importance of the questions involved in the decision is such that I think it may be useful to put my reasons and views of the case in a more permanent form, as I am not aware that the points here decided have been before distinctly raised in this state.
The Canandaigua and ¡Niagara Falls Bailroad Company, are *567a corporation authorized to take lands for their railroad, and such lands are deemed taken for the public use. Such is the declaration of section eighteenth of the general railroad act.
They entered upon and took the land in question upon purchase of the same from the owners in fee of the soil, and constructed their road thereon, with the knowledge of the plaintiffs and of such owners. They must, doubtless, be deemed to have constructive notice of the plaintiffs’ mortgage. At the time when they entered upon such premises, the value of the strip of land taken by them must have been quite trifling. As land separate from the mill race and the easement thereof, the plaintiffs could not have looked to it as constituting any appreciable portion of their security for the payment of their mortgage debt. The company omitted by mistake' or from ignorance of the actual existence of this mortgage, to extinguish the lien thereof by release or otherwise upon the strip of land so taken by them, but proceeded at a large expense to construct the arch across the race and the approaches to it in question, and have used it ever since, and its use is indispensable for their railroad. The plaintiffs’ mortgage being unpaid, thejr have come into this court as a court of equity, and sought its aid to obtain payment by sale of the mortgaged property.
Strictly speaking, their mortgage as a legal conveyance, covers all the lands embraced in it downward and upwardly, cujus est solum ejus est usque ad coslum. But in equity they have but a lien as security for their debt. And when they come to a court of equity for its aid in enforcing their mortgage, must they not do equity like all other suitors in this court ? What equity have they to extort a great disproportion in amount of their debt from these defendants ? While a court of equity, should it aid them to appropriate to their own use the value of the erections and improvements put by the defendants upon the small strip of land covered by their mortgage ? I think not. It seems to me, that the fundamental principles and actions of this court forbid it. The simple application of the maxim in equity, “ he who seeks equity must do equity,” seems to me conclusively to answer the whole *568question. It is quite analogous to the case of partitions between tenants in common. When one tenant in common comes into equity for partition of the common property, this court makes a just partition and allows, or makes a complainant allow, for improvements. This is a familiar doctrine in this court This court will not grant partition without compelling the party applying to make due compensation for improvements. (Swan agt. Swan, 8 Price R. 518; 1 Story's Equity, 655, 656 b ; Green agt. Putnam, 1 Barb. 500 ; Taylor agt. Baldwin, 10 id. 593.)
Courts of equity-will not lend their aid to deeds or acts of injustice. When they have jurisdiction of the parties andsubj.ect matter, they compel full justice to be done. When that cannot be done, they refuse their aid. It is doubtless true that courts of equity have not 3ret gone so far as to decree compensation for improvements made b3r a possessor of land under a defective title as against the true owner, except in cases of an implied agreement, as between joint owners, or where the true owner stands by and suffers improvements to be made uppn his estate without notice of his title, or in .cases of trust or fraud. In a direct suit by the bona fide possessor who had been evicted by the true owner, the court has not assumed jurisdiction to give affirmative relief. (2 Story's Equity, 799 ; Putnam agt. Riches, 6 Paige, 390.)
But as Chancellor Walworth says in this last case: “ The jDrinciple of natural equity is constantly acted upon in this court, where the legal title is in one person who has made improvements in good faith, and where the equitable title is in another who is obliged to resort to this court for relief. The court in such cases acts upon the principle that the party who comes here as a complainant to ask equity, must himself be willing to do what is equitable.” This rule, when the true owner asks relief as against a party in possession under a defective title, is uniformly applied in this court. (2 Story's Eq. §§ 799, 1237 ; Robinson agt. Ridley, 6 Mad. 2 ; Bight agt. Boyd, 6 Mad. 411, and 1 Story, 478; Green agt. Biddle, 8 Wheaton, 77.)
*569The defendants, the said railroad companies, are entitled under section 21 of the general railroad act, to perfect their title to the strips of land taken and used for their said railroads, and this court is bound to protect their possession pending proceedings for that purpose. Due compensation for such lands would be the payment of their value at the time of the defendants’ respective entry thereon with interest. But I do not think it is necessary for the defendants to go through the process of re-appraisement under the statute. This court can in this suit provide for the making of this compensation independently of the mode prescribed in this statute for a re-appraisement, and upon equitable principles upon the equity of the statute. .
The provision of this statute gives an additional remedy to the defendants. It gives them an absolute right to the title and possession of the property on making due compensation for its value at the time when it was taken by the defendants with interest thereon. It gives them in effect a right to redeem their lands from the lien of this mortgage on the payment of a rateable proportion of the mortgage debt] which they must do to the full value of the property if need be, irrespective of the improvements put thereon by the defendants. The right to perfect their title on making such compensation in legal effect, is equivalent to an apportionment of the lien of the plaintiffs’ mortgage, and limits the amount thereof chargeable to the said defendants, to the amount of such due compensation. They are not left to the caprice of the mortgagees, as perhaps might be the case with private persons.
The plaintiffs have no equity in this case, except to be paid their debt. They have no claim upon the defendants crossing this mill race, except that they shall contribute to the payment of this debt, if the same is not paid by the sale in the inverse order of alienation of the other property covered by their mortgage in just proportion and in the order of their respective titles. Obviously, these corporations must contribute in the inverse order of their respective entries upon or appropriation of the mortgaged property. All that the two railroad com*570panies should be required to pay in satisfaction of the mortgage debt, is the full value of the respective parcels of the mortgaged property taken or appropriated by them at the times of the appropriations thereof for the use of their respective railroads, with interest thereon to the time of payment. This is the due compensation of the constitution. On the payment of such sums, the decree should be deemed satisfied and discharged as respects their respective parcels, and the plaintiffs restrained from doing any act to the prejudice of their respective titles to or possession of such parcels.
Apart from these views, this is a clear case for relief to the defendants who now move. Mot only were they prevented by accident from being present, but there were many things connected with the plaintiffs’ proceedings calculated to seriously mislead them. If, however, it was clear that the order of sale adopted was correct, and that ' the defendants were entitled to no relief because of their improvements, I should then make the resale conditional on their bidding the amount of the deficiency, as well as the payment of costs, &c.
With my views, however, with regard to their rights, it should be referred to a referee to ascertain and report the amount so to be paid by the said railroad companies upon these principles, and it is so ordered and. the sale set aside on payment of all the costs since the decree, and $10 costs of opposing this motion, to be "paid by the moving defendants, to the purchaser and also to the plaintiffs.
Horn—The ease of Lemon agt. Trull, (13 How. 218,) was affirmed by the court of appeals at its last session, (December, 1858,) thus sustaining the doctrine that a claim to recoup for a breach of warranty is a counter claim. This decision overrules the case of Nichols agt. Boerum, (6 Abb. 290.)