In 1886, two men, .who will be called the promoters, entered into a written contract with the city of Belfast. The contract contained these provisions, among others. The promoters agreed to construct in Belfast a complete system of water w'orks for the extinguishment of fires, and for domestic, manufacturing, and other purposes. They agreed to place in the system forty-five hydrants, and more, if desired by the city. The city agreed to pay for not exceeding fifty hydrants in number, set upon pipe described in the construction plan, an annual rent of nine hundred dollars. For additional hydrants set upon new pipe, the promoters were to receive forty dollars each annually. It was agreed by the promoters that at the expiration of twenty years from the time water was first let into the pipes the payment of rent for each and all hydrants should cease, and that at all times thereafter they would furnish water for the hydrants free to the city.
The promotérs further agreed to supply all water for sprinkling streets and flushing gutters, and for all buildings within the limits supplied by its pipes, used by the city for municipal and school purposes, including the public library and a city hospital, and for four drinking troughs or fountains for man and beast, and for two ornamental fountains, for such sums annually as the city should assess taxes upon the franchise and works of the water system.
Further, the promoters agreed to sell and convey the system to the city at any time for such price as might be agreed upon, or in *237case of failure to agree, for such price as might be determined by commissioners in a manner prescribed by the contract.
The city agreed that the promoters should have the privilege and right to supply water for domestic and other purposes, and should be authorized to dig up the ways and streets for the purpose of laying pipes, and for doing such other work as might be necessary in the operation of the water works.
It was agreed that such of the agreements and stipulations in the contract, as the city might not then have the power to make without authority of the Legislature, were not to be binding until such authority was granted by a charter satisfactory to the city, to be procured by the promoters.
In accordance with the contract, the promoters procured a charter from the Legislature by which they and one other were incorporated under the name of the Belfast Water Company, the defendant in this case, ch. 94, P. and S. Laws of 1887. The chartered purpose of the corporation was to furnish water to the people of Belfast for domestic and other uses, and to the city of Belfast for the extinguishment of fires and other public uses. Among other things the corporation was empowered to dig up the streets for the purpose of laying its pipes, and to fix and collect water rates. The charter provided that after the corporation should commence receiving pay for water supplied by it, it should be bound to furnish, at a reasonable rate, water for the inhabitants of the city for said uses, and to the city in its corporate capacity for public uses. The charter authorized the city to contract with the corporation for water for public uses, on such terms as the parties might agree upon, including the remission of taxes upon the real estate, fixtures and plant of the corporation.
The Belfast Water Company, in 1887, constructed its water works in Belfast. The contract between the promoters and the city was not assigned by the promoters to the water company. And no new contract was made by the city with the defendant company as was authorized by the company’s charter. But December Tst, 1887, the defendant notified the city of the completion of its works in this language: “The works of the Belfast Water Company, so far as they relate to the fire service, contracted for imth the city are now ready for use, and we have the honor of turning over to *238the city the hydrant wrenches., and the use of the hydrants for fire service, in accordance with the terms of said contract.” And from that time until recently both parties have conducted themselves in apparent recognition of the contract with the promoters. The company has set the hydrants and furnished water, and the city has paid the agreed hydrant rental, amounting to between thirty and forty thousand dollars. And the company has brought divers suits to enforce contract rights. The compensation for the use of water for sprinkling and other public uses «mentioned in the contract, except for hydrants, has been paid by the remission of taxes as the contract provided.
In January, 1916, the defendant, being advised, as it says, that the contract between the promoters, or the company itself and the city was illegal, and that it was wrong for it to be performed further, notified the city that from and after April 1, 1916, it should refuse to recognize it as of binding force, and should thereafter refuse to perform thereunder. It also notified the city that unless arrangements were made by the city to pay a fair compensation for all hydrants in use, it would after April 1, cease to maintain said hydrants or permit their use by the city.
Thereupon this bill was brought setting forth the essential facts, and praying that the defendant be enjoined from preventing the plaintiff’s use of the hydrants, and that it be commanded to maintain the hydrants and to furnish an adequate supply of water therefor. The case comes before us on report.
In argument, the defendant does not question the conclusion that the promoters’ contract has been impliedly adopted by both parties, hor that the defendant is bound by the engagements entered into by its promoters as far as they were legal. It is settled that if a corporation expressly or impliedly adopts the contract made by its promoters, and obtains its benefits, it must take it with its obligations and burdens. It must do what the promoters agreed to do. Robbins v. Railway & Electric Co., 100 Maine, 496.
But the defendant contends that the contract is illegal, null and void for three reasons: 1, that it “ignores the right of the state to regulate and control the terms and conditions of service by fixing terms and conditions unalterably for all time”; 2, that it ignores the principle that utilities must serve all alike on fair terms, by a *239provision that a large and important part of the service shall be rendered without compensation for all time after the expiration of twenty years”; and, 3 that it “ignores the right of the state to levy taxes upon a just and reasonable basis by fixing for all time certain public services as the measure of all taxation of the company’s property.” For these reasons the defendant claims that it is under no duty or obligation to furnish water to the city, and that it has a legal right to discontinue the water services to the city, unless and until the city will make arrangements- to pay fair compensation.
The city takes issue with the defendant on. all these propositions. But it contends, also, that the defendant is now estopped from denying the validity of the contract which it adopted, and the benefits of which it has received. It is also urged that if the contract was ultra vires, it was so only as to the city, and that the question of ultra vires, and the contention that the contract was against public policy, can be raised only by the municipality affected, and not by the other contracting party.
It has been repeatedly held, and we think with good reason, that when a party has accepted the benefits of a contract, not contra bonos mores, he should not be permitted to question the validity of it, that he is estopped. Fort Worth City Co. v. Smith Bridge Co., 151 U. S., 294; Richardson v. Welch, 47 Mich., 309; Doane v. Lake Street etc. R. R. Co., 165 Ill., 510; Collins v. Cobe, 202 Ill., 469; State v. Germania Bank, 90 Minn., 150; Gibbs v. Craig, 58 N. J. L., 661; Flower v. Barnehoff, 29 Or., 132; Dyer v. Walker, 40 Pa., St., 147; 2 Pars. on Contracts, 961. And in Joy v. St. Louis, 138 U. S., 1, where a railroad company was in the enjoyment of a right of way through a park, and had received the benefit of a large sum of money expended by the park commissioners, under an agreement with them, the court said that without offering to return the property obtained by virtue of the agreement, it could not be heard to allege that the agreement was against the policy of the law.
Again, while it is true that in general the court will refuse to enforce contracts contra bonos mores, there is good reason for saying that the defense of ultra vires can be made only by the party whose acts, or the acts of whose agents, are claimed to be ultra *240vires. The ultra vires contract of a municipality is a legal wrong. The party that is wronged may be relieved. The other contracting party is not wronged in the eye of the law. And it would seem that it cannot seek to be relieved from a contract with which the other party is content. We have found no case where the other contracting party has been relieved, and no case even where it has sought to be relieved, from a contract ultra vires a municipality. Ultra vires is properly a defensive proposition. It is a defense to an action seeking to enforce a contract. In every case, we think, it has been the municipality that sought relief. It is well settled that courts will not declare a statute unconstitutional except at the instance of those whose rights are injuriously affected by the unconstitutional provision. They and they alone can do this. Courts will never, at the suit of one, pronounce a statute unconstitutional because it may impair the rights of others not complaining. Williamson v. Carleton, 51 Maine, 449; Wellington et al. Petr’s, 16 Pick., 87; Hingham etc. Corp. v. County of Norfolk, 6 Allen 353; Red River etc. Bank v. Craig, 181 U. S., 548. And if an unconstitutional provision cannot be attacked except 'by one whose constitutional rights have, been invaded, much more it would seem for like reasons that a mere ultra vires contract could be attacked only by the party as to whom it is ultra v.ires. The decisions of the federal courts in national bank cases are illustrative. They point to the doctrine that the ultra vires transactions are utterly void when made the basis of suit to charge the bank with liability, but when the bank seeks to enforce advantages obtained through such transactions, even though they were impliedly forbidden, they are valid unless questioned by the government. Bank v. Kennedy, 167 U. S., 362; Gold Mining Co. v. Bank, 96 U. S., 640; Bank v. Matthews, 98 U. S., 621; Reynolds v. Bank, 112 U. S. 405; Bank v. Gadsdeh, 191 U. S., 451.
Again, we think it should be said that it is at least questionable whether the company should be permitted to discontinue its service, in order to compel the city to come to its terms, for that would be the effect of it. After maintaining relations for nearly thirty years, strictly under the provisions of the promoters’ contract, it is now too late to say that the parties have not adopted it, and are not bound by it, so far as lawful. A controversy as to its legality has *241arisen. The city certainly had sufficient reason to assert its legality. The courts are seldom willing to give a water company the arbitrary power to compel the settlement of disputed claims by refusing to supply water. Wyman, Public Service Corp., sect. 458. Some expressions of the court in Wood v. Auburn, 87 Maine, 287, are peculiarly apposite. Applying them to this case they would read as follows: The parties are not on equal grounds. The city once taken onto the system becomes dependent on that system. To suddenly deprive it of water puts it to an enormous disadvantage. It must surrender its sense of injustice. Such a power in the company places the city at its mercy. The city cannot resist lest it lose the water. The case of Wood v. Auburn is not a precedent for this case, for the circumstances are not alike. But the reasoning of the court is significant.
The foregoing considerations impress us strongly, and we think afford sufficient grounds for awarding an injunction against the defendant. But were it otherwise, we think the contention of the defendant cannot be sustained.
By the charter of the company, the city was authorized to contract with it for water for public uses, on such terms as the parties might agree upon, including the remission of taxes. Instead of making a new contract, the parties, as we have seen, adopted an existing contract. And this we think they might do under the statute. It was in effect making a contract. So that the contract which the parties have mutually acted under for nearly thirty years is based upon legislative authority. The State gave the authority. We are not called upon to consider now whether the State has reserved authority to regulate and control the terms and conditions of service. The State has not yet undertaken to do it in this case. The State so far has said only that the parties might contract on such terms as they might agree upon. And so far as the contract was within the authority given by the charter it must be held to be valid. The Legislature placed no limit upon the length of time for which they might contract, and therefore we cannot. Whether the legislation was wise or unwise was a question of public policy. It was a question for the Legislature. And a legislative determination of public policy, within constitutional limitations, is conclusive upon the court. Cities as well as corporations *242are creatures of the State. And we know of no constitutional provision which forbids a contract between city and company for a supply of water for an unlimited period.
A similar question arose in Atlantic City Water Works Co. v. Atlantic City, 48 N. J. L., 378, where the city resisted the payment of water rates, on the ground that the contract for the same was without limit as to time. The court suggested that the contract, like the contract in this case, was not necessarily unlimited in time, because the city had the right at any time to put an end to it by purchasing the works. The court then said: “But, waiving this, the conclusive answer to the position is that the power to provide the city with a supply of water has been conferred by the Legislature upon the common council in an unqualified form, arid that the court has no competency to circumscribe such a grant.”
Mr. Dillon says: “When a city has statutory authority to enter into contracts for a supply of water or gas for its own use, and for the use of its inhabitants, the manner in which its statutory authority shall be exercised and the terms of any contract which it may enter into, including the number of years during which it is to continue, rests in the discretion of the municipal authorities; and the courts will not review it or set it aside in the absence of fraud, or an abuse or excess of authority, or unless the contract is so unreasonable, inequitable or unfair as to justify the interference of a court on the established principles of law or equity. The decisions do not disclose that there is any stated terms which the courts will regard as so unreasonable as to be an unfair and unreasonable exercise of the discretionary powers of the municipality.” Dillon on Municipal Corporations, sect. 1307.
But it is said that even if the city had authority to make a contract unlimited in time, it had no authority to make one that violates the legal principle that public utilities must serve all alike, without discrimination. In other words it could not make an illegal contract. And it is claimed that the provision for free hydrant service after twenty years is violative of that principle. It is true that by the common law a public service corporation must serve all similarly situated whom it is under a duty to serve, upon equal terms and without discrimination. Free service to ■some- is discriminatory. - The same principle is declared in the *243Public Utilities law of this State. Laws of 1913, ch. 129, sect. 32. The purpose of the law, both common and statutory, is to protect the public. Persons sui juris, and business corporations, are presumed to be able to protect themselves.
But one answer to the contention is that the hydrant service is not free. It has been bought and paid for. Under the unlimited powers given by the charter we see no reason why the parties might not lawfully have contracted for a hydrant service for all time to be paid for in one gross sum. If so, there is no reason why they might not contract for a gross sum to be paid in instalments. The company on the whole is entitled to reasonable returns only. And the sums contributed by the city, whether at one or many times, serve so far to lessen the burden upon other consumers. We can see no more reason why a city whose statutory power is without expressed limit may not lawfully contract for a future perpetual hydrant service for a present payment, than that it may buy or build and pay for a municipal structure for a future perpetual use. There is no mystery about a hydrant rental contract. It is a pure business proposition. The State invested the city with wide discretionary powers. It must be assumed in the absence of proof to the contrary, that the powers have been exercised in a manner supposed to be advantageous to both parties. There is nothing in the case which shows that the contract was unreasonable, inequitable or unfair to the city. Instead of contracting for a gross sum, or for annual payments, they contracted for twenty year payments. In effect, the city paid the entire hydrant rental in twenty years. A telling point is that the city has paid the entire contract price. The company has received it, and still keeps it. It would be grossly inequitable to permit the company to repudiate the contract now. See Bank v. Matthews, 98 U. S. at p. 629. It must abide the contract so far as hydrant rentals are concerned.
Another answer is, that free service to the public is not, at common law, unreasonably, and therefore, unlawfully, discriminatory. The law against unreasonable discrimination rests on public policy. It is forbidden because it is opposed to the interest of the public, Which requires that all should be treated alike under like circumstances. Discriminations, however, in favor of the public are not Opposed to public policy, because they relieve the people generally *244of part of their burdens. In the absence of legislation upon the subject such discriminations cannot be held illegal as matter of law without overturning the foundation upon which the rule itself is built. New York Telephone Co. v. Siegel-Cooper Co., 202 N. Y., p. 511. So in Superior v. Dayton County Telephone Co., 141 Wis., 363, a contract binding a telephone company to maintain, without charge, telephones in the public offices of the city, was held not to be invalid as against public policy. The court said: “The contract in. this-case having been made before the legislation occurred prohibiting discriminatory rates, such legislation does not cut any figure in this case. If the contract were valid when made it is within the constitutional protection precluding the Legislature from impairing the obligations of contracts. . . . Discriminatory contracts between public utility corporations and their patrons which are held to be void as inimical to the public good are so held because unreasonable advantage is thereby given to one customer or a class over others, whereas all have a moral and legal right ta equality of treatment. In the case of the contract being between a private corporation and the state or other public corporation, whatever advantage the particular customer has over general customers, obviously inures to the benefit of the latter in the aggregate. In other words in the ultimate there is no discrimination which is inimical to the public good, and hence no violation of public policy.” See Wilcox v. Consolidated Gas Co., 212 U. S. 19; Interstate Commerce Com. v. B. & O. R. R. Co., 145 U. S., 278; Water Works Co., v. Kansas City, 4 McCreary, 198; Dempsey v. N. Y. Central etc. Ry. Co., 146 N. Y., 290; Wyman on Public Service Corp., sect. 1304.
This states the case at common law. If it be said that the common law rule has been abrogated by statute, and that the state under its reserved power may enact regulatory provisions which in effect abrogates the contract, it may be answered that the state has not attempted to do so in this case, except, as it may be urged, by the Public Utilities Statute, chap. 129, Laws of 1913. Section 31 of that statute forbids unreasonable preferences. But as we have seen, discrimination in favor of a municipal corporation is not unreasonable. Section 32 makes it unlawful for any person or corporation to receive any rebate, discount or discrimination in *245respect to any service rendered or to be rendered by any public utility. We think there is nothing in this statute which tends to show that the Legislature intended to impair the obligation of any existing lawful contract. The language indicates that the legislation was to have a prospective, not a retroactive, effect. See similar case of Public Service Electric Co, v. Board of Public Utility Comr’s, 88 N. J. L., 603. Besides to give it a retroactive effect would impair the obligation of a contract valid at common law, which is forbidden by the federal constitution. See Superior v. Douglas County Telephone Co., supra.
But it is said further that the contract is illegal because of the provision for the remission of taxes in consideration of water furnished for several public uses. With respect to this contention it may fairly be said that its determination is not necessarily involved in this case. The contract provisions for free hydrant service and for other public service to be compensated by remission of taxes are distinct and separable. One might be invalid without affecting the validity of the other, and we have held the hydrant service provision to be valid. The issues raised by the bill in this case relate only to the hydrant service. But the question of remission of taxes has been argued, and we will notice it briefly.
The power of remission is granted by the charter. And it may be said here that all the cases where municipalities have attempted to contract without legislative authority are not pertinent to the present discussion. Here the legislative permission, which is precise and express, must control, unless unconstitutional. It is not claimed to be unconstitutional. The State has said that these parties may by contract fix the value of certain public services as the equivalent of the amount of taxes assessed upon the company’s property, so that one may off-set the other. In Portland v. Portland Water Co., 67 Maine, 135, it was settled that the Legislature may authorize the exemption or remission of taxes as equivalent compensation for public service rendered. So are the cases elsewhere. See cases collected in 40 Cyc., 788. In the Portland case the power was granted by statute for six years only. In Maine Water Co. v. Waterville, 93 Maine, 586, it appeared that there was legislative authority for a contract for a municipal supply of water, for which such compensation was to be paid as might be agreed *246upon, but nothing was said about remission of taxes. A contract was made by which the city agreed to pay for water service a sum annually which should “be equal to the tax annually assessed against the company.” The court held the contract, which was limited in time to twenty years, to be valid. It said: “A municipality may, for a reasonably adequate compensation in the way of service rendered to it for municipal purposes, agree to make compensation therefor, for a term of years and not unreasonably long, either in whole or in part, by reimbursing the company, in whole or in part, the amount that the company may be obliged to pay as taxes assessed upon its property.” The Waterville case is to be distinguished from the one at bar in this respect, that in that case there was no express legislative authority to remit taxes. The remission was made and upheld under a general grant of power to make a contract. In this case the charter is express, and fixes no limit of time for the operation of the contract. This distinction is noticed in Home Telephone etc. Co. v. Los Angeles, 211 U. S., 265, cited by the defendant.
And if, notwithstanding the charter, the question of public policy were open to us, it may be said that if such a contract is to be deemed reasonable at the outset, for a limited time, it is not unfair to presume, in the absence of proof to the contrary, that the value of the public services and the amount of taxes assessed would continue, pari passu, to be equivalent.
We conclude that the contract is valid, and that an injunction should be awarded as prayed for.
Bill sustained with costs.
Permanent injunction to issue as prayed for.