Opinion by
Mr. Justice McBride,This is an appeal from a final decree in equity. It arises out of a dispute involving a lease of property for the purpose of drilling and production of oil and gas.
William Wingert gave a lease for oil and gas on January 25, 1917 to T. W. Phillips, Jr., on 30 acres of a 46 acre tract owned by him. This lease was to exist for “the term of twenty years and as long thereafter as oil or gas is produced in paying quantities or operations for oil or gas are being conducted there*103on.” It provided for a payment of %th of the value of the oil produced and saved from the premises and a payment for the gas at a minimum of $50 per year to a maximum of $200 per year, and further, a payment of $7.60 a year, payable quarterly, so long as there was no drilling for either oil or gas on the premises.
William Wingert died on March S, 1925 and by the residuary clause of his will the 46 acre tract was left in trust for a period which was terminable in the discretion of his trustees, not however to exceed fifty years. His executors, as trustees, were given power to sell real estate, make deeds and full power and authority to lease, sell or develop all mineral lands, including coal, oil and gas. Hence, the executors had the power to terminate the trust any time within the fifty-year period either by selling the assets or distributing any and all of the res as they deemed most beneficial. These executors, as trustees, on July 27, 1936 made a lease to T. W. Phillips Gas & Oil Company for the same 30 acre tract upon the same terms.
In 1952 no drilling having taken place, the executors, who in the meantime had been paid $7.60 a year, quarterly, by the Phillips Co., sold to the plaintiffs, C. E. Wingert and Alverta Wingert, his wife, the entire tract of 46 acres which, as noted above, included the 30 acres described in the two leases. The Wingerts later made an agreement with Lloyd I. Wingert for division of any monies received as a result of the leasing of the land for the production of oil and gas.
Although defendant had continued to make the quarterly payments, plaintiffs, as owners, gave defendant notice, in writing, on January 25, 1954, that the lease was terminated and that defendant had no right to enter on the property. Plaintiffs, at the same time however, indicated their willingness to negotiate a neAV lease, at least in relation to the royalty payments. *104Nevertheless, after having received such notice from the plaintiffs, defendant drilled a well on the 30 acres in the month of March, 1956 to a depth of more than 7.000 feet which produced 1,243,000 cubic feet of gas per day. The hydro-fracture of Oriskany sands increased the gas production to 4,548,000 cubic feet per day; no meter or other device was placed on the well but the gas produced from it went into the distribution lines of the defendant and was sold by defendant at retail. It was stipulated that the gas produced from this well from June 12, 1956 to February 25, 1957, inclusive, was 854,167,529 cubic feet, the value of which at the field price prevailing of 27% cents per thousand cubic feet was $234,896.07. It is conceded that the accepted royalty paid by gas producers to owners of land is %th of production which in this case would be $29,362 for the above stated period.
This agreement, under which the defendant claims the right to drill, is an antiquated type of agreement providing generally for so-called shallow well drilling and contemplated the old method of paying for gas sold off the premises by a system of pressure gauging. It is clear from the very facts of this case that such a method of computing royalty payments is totally inadequate and unfair in deep well drilling, especially where the artificial method of hydro-fracture is used. If the minute pressure in the well were to remain constant and the diameter of the shaft is the same, the flow of the gas well is directly dependent upon its depth. In other words, a well 10,000 feet deep, will produce 10 times as much gas in a given time as a well 1.000 feet deep, and therefore a maximum payment provision of $200 per year bears no actual relation to the amount of gas being taken from the land.
Defendant tendered to plaintiffs the payment of $200 per year royalty as provided in the lease of July, 1936 but plaintiffs refused to accept it and insiead *105filed a bill in equity in which they contended that the 1936 lease by the executors was of no effect and that they, as present owners of the property, had standing to say so. Indeed, their right has not been questioned. The case was tried; the court below found facts, inter alia, as noted above; held that the lease was valid, dismissed the bill and entered a decree in favor of defendant.
Plaintiffs contend that the purported lease of 1936 is not enforceable and that the defendant company is on their property actually producing gas far beyond the quantities contemplated and therefore plaintiffs should be compensated in a reasonable amount, i.e., %th of the value of the gas produced, for that which is actually being taken on the theory of unjust enrichment. It is clear that the doctrine of unjust enrichment does not deal with situations in which the party to be charged has by word or deed legally consented to assume a duty toward the party seeking to charge him. Instead, it applies only to situations where there is no legal contract. Third National Bank and Trust Company of Scranton v. Lehigh Coal Company, 353 Pa. 185, 44 A. 2d 571. The basic determination in this case is therefore the validity of the 1936 lease.
At that time, the trust had been in existence for 11 years since the death of William Wingert in 1925. By the provisions of the Will the maximum duration of the trust was 50 years.
The lease in question, however, provided as follows: “To Have And To Hold the said premises, with the exclusive right to operate the same for said purposes for the term of twenty years, and as long thereafter as oil or gas is produced in paying quantities, or operations for oil or gas are being conducted thereon, . . .”
It is obvious from the above-quoted provision that this lease could remain in effect for an indefinite time *106in the future and in any event quite possibly for a period beyond the duration of the trust. As Judge Gest said in Craig’s Estate, 24 Dist. 851, “it Avould appear that a trustee has at most a general implied poAver to lease for such a term as is reasonable and customary, considering the nature and location of the property and the probable duration of the trust, with due consideration of the interests of those entitled in remainder as well as the life tenants.” (Emphasis supplied). See also Standard Metallic Paint Co. v. Prince Mfg. Co., 133 Pa. 474, 19 Atl. 411 and Beutel Estate, 347 Pa. 237, 32 A. 2d 224. The Restatement, Trusts 2d, §189 substantially enacts this rule and provides: “Except as otherwise provided by the terms of the trust the trustee can properly lease trust property for such periods and with such provisions as are reasonable.”'
In Comment c thereto in speaking of the duration of leases it is noted that if the trust is terminable at a fixed time the trustee cannot make a valid lease which will extend beyond that period, while if the trust is not terminable at a fixed time a valid lease cannot be made by a trustee which would extend beyond the probable period of the trust. It is clear that whether we regard this trust as terminable at a fixed time, i.e., 50 years, or at an indeterminate earlier time, its duration offends this rule. Who is to say, or who can determine how long oil or gas will be produced in paying quantities or for how long operations for oil or gas will be conducted thereon? In any event, it may extend for longer than 50 years, which is the maximum length of the trust. The Restatement, however, qualifies this rule by providing that a lease which is improper because of its extended duration is valid for the actual duration of the trust and can be set aside only as to the excess. If, therefore, the executors had no power to terminate the trust either by sale or distribution of the assets, we could not at this time say *107that the lease extended beyond the duration of the trust and is thus invalid. The trust here in question, as to the property which is the subject matter of this case, was however terminated in 1952 by the deed of conveyance by the executors as trustees of the William Wingert Estate to the plaintiffs herein, O. E. Wingert and Alverta Wingert, his wife. This sale was in complete accord with the Will of William Wingert which provided: “They [the executors] shall have full and complete power to sell and convey any and all real estate, at anytime or times with [in] fifty years from the date of my decease, . . .”
“My said executors shall divide the proceeds of my estate, ... at such time or times as in their discretion may be deemed best, within said period of fifty years . . .”
Therefore, when the executors as trustees conveyed a part of the trust estate to the plaintiffs in compliance with the powers granted to them in the Will, that real estate with all the incidents thereto, including the gas royalty passed out of the trust estate. It was no longer under the jurisdiction of the trustees or subject to the terms and conditions of the trust as imposed by the Will. The land and its incidents after conveyance were no longer trust res, instead, the purchase price of the land became part of the corpus and the lease no longer served the trust. It was therefore terminated. The defendant ought not to be heard to complain of this result. At the time the lease was made, it had full knowledge of the authority and capacity of the lessor. If they had wished to protect themselves they could have insisted upon approval of this agreement by the Orphans’ Court in accordance with Section 31 of the Fiduciaries Act, 1917, P.L. 447, 20 P.S. §717.1
*108Had they done so it is quite probable that this entire problem would have been obviated. Plaintiffs did everything in their power to prevent defendant from acting under its claimed contract. They notified defendant in writing that the agreement was terminated and defendant had no rights thereunder. They protested defendant’s drilling. They offered to negotiate a new contract as to the royalty provisions. They refused the tender of the former $200 royalty. They sought relief from the court below. They now seek relief from this Court.
The lease in question being terminated, what then is the remedy of the owners of the land for the loss which they have incurred? The courts have recognized for many years2 the existence of such situations and have by one method or another tried to make injured and innocent parties whole and to make those who for one reason or another have received a benefit at the expense of others to be charged for that benefit.3 Ordinarily, however, the doctrine of unjust enrichment is involved in such cases and the restitution to the injured party is the amount of the enrichment received by the defendant. See Binns v. First National Bank of Cal., *109367 Pa. 359, 80 A. 2d 768; Gribben v. Carpenter, 323 Pa. 243, 185 Atl. 712.
In the instant case there was, at the time defendant drilled, an unenforceable contract and the defendant has been and is presently being enriched at the expense of the plaintiffs in a gross measure. The effect of plaintiffs’ notice to the defendant corporation and its refusal of the subsequent royalty payments terminated this agreement at least to the extent of the royalty payments. The defendant had admittedly received gas of the value of approximately $234,000 for a little over 7 months production and has maintained throughout that it should pay merely $200 a year for the privilege of removing this amount of gas. It is apparent from the mere statement of the facts in this case that we are here presented with the exact situation in which the doctrine of unjust enrichment must be invoked. Plaintiffs are entitled to the relief they seek.4
Accordingly, the decree of the court below is reversed at the defendant’s costs and the record remanded for the entry of a decree requiring an accounting by the defendant to the plaintiffs for %th of the proceeds of the gas from the plaintiff’s land, i.e., $29,362 for the stated period, and such additional relief as shall be just and necessary in accordance with this opinion.
Tlie act provides: “Unless it be otherwise provided by the Will, any testamentary trustee shall have power to make a lease *108of real estate included in the trust, for a term not exceeding five years; ... If any testamentary trustee or guardian shall deem it advisable to make such lease for a longer period than aforesaid, the orphans’ court of the county wherein such real estate shall be situated, on the application of such trustee or guardian, being aided where necessary by the report of a master, may authorize such trustee or guardian to lease such real estate, on such terms and conditions, at such rental, and for such period as shall appear just and equitable to said court, with the same force and effect as though said lease were made by the beneficial owner or owners, and he or they were sui juris and owned the property in fee. . . .”
See Hertzog v. Hertzog, 29 Pa. 465.
See Restatement, Restitution, §1: “A person who has been unjustly enriched at the expense of another is required to make restitution to the other.”
We do not treat the defendant corporation as a trespasser and plaintiff has not asked that we do so. Even in a legal action of ejectment, where one party has entered unlawfully upon the property of another, with the knowledge of that other, and has, as here, expended large sums of money, the dispute must be settled in accordance with equitable principles. Oliver v. Railway Company, 131 Pa. 408, 19 Atl. 47; Connellsville Gas Coal Co. v. Baltimore & Ohio R. Co., 216 Pa. 309, 65 Atl. 669.