This is an appeal from the district court of Emmons county, third judicial district, from an order of the trial judge, vacating a temporary restraining order and denying a permanent injunction.
The plaintiffs are taxpayers of Emmons county and brought this suit to enjoin the issuance of warrants for disbursement of money out of the bridge fund of the county in payment for nine structures built under three separate contracts between Emmons county and the; defendant and respondent Eogel, doing business under the name of the Linton Eridgo and Construction Company. The commissioners entered into three separate contracts with the respondent Eogel for the construction of nine bridges or culverts and for the payment of the contract price, aggregating approximately $14,000. The contract for the, construction of projects A, H, and I was executed June 30, 1922; the contract for the construction of projects .B, D, E, E, and G was awarded to respondent Eogel on July 20, 1922, and on August 18, 1922, the contract ivas awarded to respondent Eogel for the construction of project O. Appellant claims that all these contracts were illegal and wholly void for reasons hereinafter stated.
Warrants were issued in full for structures referred to in the record as G, D, E, TI, and I; warrants were issued for one half of the contract price of the structure A; no warrants were issued for B, O, and E. The warrants that were issued were registered with the county treasurer. The record shows that the bill on account of the construction of structure F was allowed by the county commissioners in the sum of $1,713.76. The structures have become a part of the highway system of Emmons county and hence the materials cannot be returned to the contractor.
Two suits were commenced, but they wore consolidated below and on this appeal. Upon the trial of the issues, the court found that the bridges and structures were erected in good faith; that they are necessary; that the county received full value; that the warrants have been issued in payment thereof as indicated in the'preceding paragraph; that all the structures were completed before suits were commenced; that the taxpayers of the county now enjoy the use of the structures as a part of the highway system of the county; that the county commissioners, or some of them, with the county superintendent of highways, investigated all of the cases before the contracts were let and found that in each case the structure was necessary; that the old structures, replaced *828by new ones, were in bad repair, the timbers rotten and tbeir use dangerous to tbe traveling public; and that plaintiffs and other taxpayers of the county made no complaint before the suits were commenced. The court also found that, with reference to structures A, D, and E, petitions were filed as provided in §§ 1951-1953, Comp. Laws, 1913. The court further found that structures A and B are bridges, A of wood and B of concrete; that structures O, D, E, E, and H are culverts; and that structure I is a concrete abutment to a bridge; the court specifically found that the county commissioners acted in good faith and their acts were free from “any suspicion of fraud, collusion or thought on their part to do anything contrary to law.” The same is true as to the action of the county superintendent of highways, the county auditor, and county treasurer. The court further found that the structures were all properly built, strictly in accordance with the plans and specifications; that the contract price, in each instance, was the reasonable value of the structure and that Emmons county received dollar for dollar value in these improvements, and did, in fact, receive “everything that under the law it would be entitled to under legal contracts fully performed.”
It is contended by the appellants that the county commissioner's had no authority to enter into the contracts with the contractor, that the statutory requirements were not complied with and that, therefore, the plaintiffs are entitled to an injunction restraining the authorities of Emmons county from paying the warrants already drawn, and from issuing new warrants in payment of the work. The appellant thus states the gist of the action: “It is well here to bear in mind that the gist of this action is to enjoin the issuance of warrants or the payment of warrants already issued against the Emmons County Bridge Bund in discharge of the contract price and consideration for these bridges.”
Section 1951, Comp. Laws, 1913, as amended by chapter 12, Session Laws, 1919, reads as follows:
“Sec. 1951. Petition. Bids. - Whenever a majority of the freeholders of a civil township or a majority of the freeholders living within a radius of 3 miles of the proposed location, shall petition the board of county commissioners for a bridge at a specified location within such township, or within any incorporated city or village, when the cost of such bridge shall exceed the sum of $100, it shall be the duty of the board of county commissioners to view and investigate the necessity of *829such proposed bridge; and if such county board approves its location and building, it shall proceed to advertise in the official paper of the county, for a period of thirty days, the plans and specifications of the proposed bridge, asking for sealed bids for the building of such bridge, to be submitted to them at their next regular or special meeting, at which meeting of the board it shall proceed to examine all proposals or bids for the building of such bridge, and if such board sees fit they shall award the contract to the lowest responsible bidder; requiring such bidder to give a bond in a sum not less than the amount stipulated in the bid or contract conditioned for the faithful compliance with the terms of such bid or contract, which bond shall be approved by the board of county commissioners and filed in the office of the county auditor.
“Provided, however, that the board of county commissioners shall have the authority to refuse any or all bids received, and to proceed to construct such bridge under their own supervision, and in the manner deemed by them most expedient and to enter into contracts for the labor or material to bo used in the construction of the same.”
Section 1953, Comp. Laws, 1913, is as follows:
“Sec. 1953. Supervision and repairs of bridge. Any bridge built under the provisions of § 1951 shall be'under the supervision of the board of county commissioners, and the cost of all such building and repairs shall be estimated by the county commissioners and paid for by the county; provided, however, that should any emergency arise, requiring the immediate rebuilding or repairing of any bridges, the board of county commissioners are hereby authorized to rebuild or repair, as the circumstances require, and without advertising for bids, in case said work can be performed by a responsible party, at a price not to exceed the last bid accepted by said board of county commissioners for like work.”
The failure of the county commissioners of Emmons county to comply with the statutes may be summarized as follows: They failed in all cases to advertise for bids for a longer period than fifteen days; in some cases no petitions were filed; and in some cases there were either no bonds executed by the contractor or approved by the board, or the bond which was executed was of extremely doubtful legality and sufficiency.
It will be perceived that the construction and repair of bridges and culverts is within the general scope of the powers of the county board. *830Upon ibis state of the record, the question arises whether or not the plaintiff taxpayers are entitled to an injunction restraining’ the county commissioners from paying money from the county bridge fund to the contractor who has fully performed the work.
The contention of the respondent is that, inasmuch as the record discloses and the findings of the trial court show that the contracts were fairly entered into, fully and honestly performed, full value rendered to the county, and the work was necessary and the subject-matter of the contract was within the scope of the powers of the board, therefore the county, having received and accepted the benefits, and notwithstanding the fact that the contract may be illegal and unenforceable, owes at least a moral obligation to pay the actual and reasonable value of the materials furnished and the services rendered in the construction of the bridges, and that a court of equity should not enjoin such payment. On the other hand, it is contended by the appellant that the contracts are illegal and void; that the courts will not permit recovery upon an implied contract because the court will not permit an act prohibited by law to be accomplished by indirection; and that equity, at the instance of a taxpayer, should enjoin the payment of the warrants.
At the outset, it should be pointed out that this is not a proceeding by the contractor to recover upon a contract or to recover the reasonable value of the services and materials furnished Emmons county in the construction of the bridges or culverts described. It is a suit by taxpayers, invoking the equity jurisdiction of the court, to enjoin the proper officers of Emmons county from paying the respondent. Eogel, for materials and services rendered Emmons county and which, according to the findings of the trial court and the record before us, resulted in the receiving of full value under the contracts, alleged to be illegal and void, for work found to be necessary by the county commissioners, acting in good faith and within the general scope of their authority.
It is clear that the county commissioners, in entering into these contracts, failed to comply with several statutory requirements. The statutes, however, nowhere provide that in the event these provisions are not complied with, no contract shall be entered into or that, if contracts be entered into, they shall be illegal and void. This, therefore, is not. a case where the contract is expressly prohibited by any statutory or constitutional provision.
*831Tbe doctrine of ultra vires in tbe law of municipal corporations lias not always been applied by tbe courts in tbe same sense or witb tbe same meaning. Strictly speaking, an act is ultra vires when it is wholly beyond tbe power of tbe municipal corporation under any circumstances to perforin it; in another and less restricted sense, a contract may be ultra vires although the subject-matter is within tbe scope of the powers of tbe corporation if tbe manner in which tbe contract was entered into is prohibited by tbe Constitution or by statute. There seems to be no conflict in tbe authorities on tbe proposition that be who transacts business witb a municipal or public corporation, witb respect to a matter wholly beyond its corporate powers, can have no relief in law or in equity. That is to say, a contract entered into witb a public corporation, concerning a subject-matter wholly beyond its powers, cannot constitute a basis of recovery in an action at law, nor will tbe court; upon any equitable theory, permit a recovery. Such contracts are wholly void because they are prohibited and of this fact all persons dealing witb public corporations must take notice.
In tbe case before us, it must be conceded, laying aside, for tbe moment all technical legal rules, that tbe position taken by tbe plaintiffs presents few, if any, aspects that appeal to tbe conscience of a court of equity. They claim to represent taxpayers who have never complained, though many of them must have bad actual knowledge that tbe respondent Fogel was making valuable improvements that would ultimately be used by Emmons county, and who, after all tbe work has been fully and fairly completed, at an expense of many thousands of dollars to tbe respondent, under contracts fairly and honestly entered into and upon competitive bidding in fact, for the erection of an improvement of public necessity, now come into a court of equity and invoke rules of law to prevent tbe duly constituted officers of tbe county from paying tbe actual and fair value of this public improvement. It is difficult to escape the conclusion that here it was attempted to invoke tbe equitable powers of tbe court to aid in tbe accomplishment of a purpose manifestly inequitable. It would be little less than appalling for a court of equity to be compelled to confess, not only that its arm is powerless to prevent gross injustice, but that at tbe instance of a litigant, it can be made tbe unwilling instrument in tbe actual furtherance of wrong and inequitable conduct.
*832It is said that equity must follow the law and the chancellor must give full force and effect to the legislative will as expressed in the statutes. This is undoubtedly correct. Statutes governing the method of contracting by public corporations and the rules of law laid down by the courts concerning the interpretation of such statutes, are generally designed for the protection of the interests of the taxpayers and of the public at large. When it happens that such public and private interests have been fully protected, as intended by the statutes and the rules of law, when, notwithstanding a failure to comply with the letter of the law, its spirit and purpose have been fully regarded, can it be said that a court of equity, in preventing the repudiation of a moral obligation due to an individual, though such repudiation be in obedience to the strict letter, but, in fact, in violation of the liberal spirit of the law, "exceeds its powers, abuses its great prerogatives, and substitutes its own arbitrary will for the will and purpose of the legislature? We do not think so. To so hold would be to attribute to the legislative branch of the government a willingness, if not an actual purpose, to be unjust and oppressive, to be unwilling to do equity notwithstanding the protective purposes of the statute have been realized, and to refuse to recognize that an individual who deals with a public corporation, in good faith and within the general scope of its powers, may acquire rights which, in equity and good conscience, should be protected. In short, it would be to ascribe to the legislature a purpose to relieve the state and its political subdivisions from the ordinary obligations of honesty and fair dealing which ought to rest equally upon all persons, ■ natural and artificial, having legal capacity to contract.
Speaking of the vital power of equity to do justice and prevent injustice, the supreme court of Wisconsin said in Harrigan v. Gilchrist, 121 Wis. 127, 235, 99 N. W. 936:
“There is no vitality in precedents: there is in rules. They are susceptible of expansion along every line necessary to reach new conditions. The ingenuity of man in devising new forms of wrong cannot outstrip such development. In all situations and under all circumstances, whether new or old, the principles of equity will point the way to justice where legal remedies are infirm. Precedents will be a constant guide, but never a bar. Where a new condition exists, and legal remedies afforded are inadequate or none are afforded at all, the never-failing ca-*833pacitj of equity to adapt itself to all situations will be found equal to the case, extending old principles, if necessary, not adopting new ones, for that purpose.”
In a recent case decided by the supreme court of Minnesota, First Nat. Bank v. Goodhue, 120 Minn. 362, 43 L.R.A.(N.S.) 84, 139 N. W. 599, the court had under consideration the question of the right of the plaintiff to recover $2,800 loaned to the village of Goodhue, pursuant to a transaction wholly illegal and void. The court held the village liable and that the plaintiff was entitled to recover. The court say among other things: “The foundation of the rule is found in the fact that the municipality has received money or property for a legitimate municipal purpose for which equity and good conscience require full payment.” In this case the act of the village council was not ultra vires in the strict or primary sense, but the power was not exercised in a legal manner.
This question was again before the supreme court of Minnesota in Fargo Foundry Co. v. Callaway, 148 Minn. 273, 181 N. W. 584. The plaintiff in that case contracted with the defendant village to repair a steel water tank and to install some machinery. The contract was void because not let upon competitive bids as required by the general statutes of Minnesota. The village had the power to contract with reference to the subject-matter, but the power was exercised in a manner contrary to the statutes. The court say:
“The improvement served a municipal purpose and the contract was one that the city had power to make, and, had the essential requirements of the law been complied with, the contract would have been enforceable. In such a situation the village may be compelled to pay the value of what it has received. The express contract disappears from the case. The cause of action arises, not from any contract on the subject, but from the general obligation to do justice which binds all persons, natural and otherwise. The .obligation to pay is measured by the benefit which the village has received.”
Speaking of the moral obligation of the defendant to pay for services rendered, though an action at law might not be maintained on the contract, the Pennsylvania supreme court say:
“A moral obligation, in law, is defined as one Svhich cannot be enforced by action, but which is binding on the party "who incurs it, in *834conscience and according to natural justice;’ and again, a 'duty which would be enforceable by law, were it not for some positive rule, which, with a view to general benefit, exempts the part}', in that particular instance, from legal liability.’ . . . Councils, it is true, are trustees, and the law limits their expenditure of public money to public purposes, but they are also representatives of their constituents, and delegates of the city’s legislative powers; and there is nothing in the law, or in sound public policy, to prohibit the city from being honest, and paying its bona fide debts, which are good in conscience and justice, though, for sufficient other reasons, there is a general rule which prevents them from being enforceable by law.” Bailey v. Philadelphia, 167 Pa. 569, 46 Am. St. Rep. 691, 31 Atl. 925.
“Equity will not coerce the enforcement of a strict legal right, however clear, if thereby injustice and inequity will be done.” Dorner v. School Dist. 137 Wis. 147, 19 L.R.A.(N.S.) 171, 118 N. W. 353.
“In some jurisdictions the courts have refused to enjoin an act manifestly illegal when it has seemed more inequitable to grant than to refuse an injunction.” Pom. Eq. Jur. § 1776; Brasher v. Miller, 114 Ala. 485, 21 So. 467; Pillager v. Hewett, 98 Minn. 265, 107 N. W. 815.
After reviewing many authorities, the Kansas supreme court says:
“From the authorities we think the following principle may be educed: Where a contract is entered into in good faith between a corporation, public or private, and an individual person, and the contract is void, in whole or in part, because of a want of power on the part of the corporation to malee it, or to enter into it in the manner in which the corporation enters into it, but the contract is not immoral, inequiable, or unjust, and the contract is performed, in whole or in part, by and on the part of one of the parties, and the other party receives benefits by reason of such performance over and above any equivalent rendered. in return, and these benefits are such as one party may lawfully render, and the other party lawfully receive, the party receiving such benefits will be required to do equity towards the other party, by either rescinding the contract, and placing the other party in statu quo, or by accounting to the other party for all benefits received fox which no equivalent has been rendered in return; and all this should be done as nearly in accordance with the terms of the contract as the law and *835equity will permit.” Brown v. Atchison, 39 Kan. 54, 7 Am. St. Rep. 515, 17 Pac. 474, 475.
In the case of Farmer v. St. Paul, 65 Minn. 176, 33 L.R.A. 199, 67 N. W. 990, the facts were as follows: Farmer was a taxpayer of the city of St. Paul and. brought this suit to enjoin the city from paying the defendant, the House of the Good Shepherd, $71.50 for boarding female prisoners committed by the municipal court of the city and to enjoin the city from allowing any sum in the future for such purpose, and further, to compel an accounting between the city and the House of the Good Shepherd, of all monéy paid to it prior thereto. For many years the city had committed female prisoners to the care of this institution under an ordinance which was wholly invalid, and had paid the institution a very reasonable compensation for such services. The reason for doing this was that the city had no facilities to take care of delinquent female prisoners. The court found the ordinance void, and that the city council had no authority, whatever, to pay the money or to enter into the engagement. The court say among other things:
“Waiving the technical objection that there is no allegation in the complaint that he has requested the city to bring such an action, we are of the opinion that, on the merits, he is not entitled to maintain this action for the purpose of compelling such repayment, for the simple reason that it would be grossly inequitable to permit him to do so. The reason we have suggested why the payment of $71.50 ought not to be enjoined, applies with greater force to past payments.” In refusing to enjoin the payment of $71.50 for services already rendered, the .court said among other things: “While it is true that, upon grounds of sound public policy, the doctrine of ultra vires is applied with greater strictness to municipal than to private corporations, and that in this state a taxpayer may enjoin an unauthorized appropriation of public money, yet in cases where the proposed appropriation is only technically illegal, and it would be more inequitable to grant the injunction than to refuse it, it may be refused. . . . The city has received full consideration for the proposed payment and in equity and good conscience the claim ought to be paid; and the refusal to enjoin its payment, under such circumstances, by the trial court, was a proper exercise of its discretion.”
In the Pillager Case, supra, the court say, referring to the right of *836the corporation to recover money paid the contractor under a void contract:
“The consideration for such payment was full and fair, and, in equity and good conscience, it ought to have been paid by the plaintiff. Such being the case, it would be most inequitable and unconscionable to compel the defendant to return the money and bonds paid to him under the circumstances found by the trial court, and we hold that the plaintiff cannot maintain this action to recover them.”
The court points out the fact — the distinction has been adverted to heretofore in this opinion — that a case where there is no power in the public corporation to contract, with reference to the subject-matter, is to be distinguished from one where the power exists, but the contract is void because entered into in violation of some statutory provision prescribing the manner in which the power shall be exercised. It seems to bo well settled, therefore, in Minnesota, that equity will not enjoin the payment of the consideration after full performance by the contractor, although the contract with a public corporation was wholly void, wheve the subject-matter is within the general power of the corporation and the contract is not prohibited by statutory or constitutional provision, where there has been no fraud, where full value has been rendered, and where the work was necessary and the benefits have been accepted and are in use by the public. "Within these limitations we think the rule sound in equity and it fully protects the interests of the taxpayers and the general public as intended by the legislature.
Counsel for the appellant cite several North Dakota decisions in which this court has either refused recovery upon contracts of public or municipal corporations entered into in violation of a prohibitory statute or sustained the action of the trial court in enjoining payment under such contracts or the further prosecution of work thereunder. We have examined all of these decisions carefully and we find that no one of them is in point. They are either cases where the county commissioners sought to contract with private individuals for the performance of serwices which the constitution required that certain public officers perform; Storey v. Murphy, 9 N. D. 115, 81 N. W. 23; Fox v. Walley, 13 N. D. 610, 102 N. W. 161; or cases where recovery was asked under, or an injunction sought against the performance of a contract prohibited by statutory or constitutional provision; State ex rel. *837Diebold Safe & Lock Co. v. Getchell, 3 N. D. 243, 55 N. W. 585; Engstad v. Dinnie, 8 N. D. 1, 76 N. W. 292; Roberts v. Fargo, 10 N. D. 230, 86 N. W. 726; State v. School Dist. 18 N. D. 616, 138 Am. St. Rep. 787, 120 N. W. 555; McKinnon v. Robinson, 24 N. D. 367, 139 N. W. 580; or ivbere the real power to act in the premises was lodged in the voters and the voters had either taken no action or refused to authorize the expenditure; Capital Bank v. School Dist. 1 N. D. 479, 48 N. W. 363; Henderson v. Long Creek Dist. 41 N. D. 640, 171 N. W. 825 ; State ex rel. Diebold Safe & Lock Co. v. Getchell, supra.
It should be noted that in none of the cases cited by the appellant from this court were the equities in favor of the contractor as strong as they are in the case at bar. In the Engstad Case the contractor knew that his contract was of doubtful validity and, in fact, commenced operations for the express purpose of inviting litigation to determine the question. It is true that in the Diebold Safe & Lock Co. Case, supra, the materials had been delivered, but that was a mandamus proceeding and not an action in equity and an express statutory provision required a submission of the question of making the expenditure to the voters of the county, which, however, had not been done. It was a case of complete lack of power in the commissioners to act. The power there was reserved to the electors and for the commissioners to act without action under the statute by the electors was a clear case of usurpation of power and not merely an illegal exercise of power.
Appellants rely strongly on the case of Bayne v. Thorson, 37 N. D. 187, 163 N. W. 822. In that action the plaintiff sued on a contract that was void because the county commissioners had failed entirely to advertise for bids. The court held that there should be no recovery on the contract and the decision is carefully limited to that single point. No attempt was made to recover the reasonable value of the work and materials furnished. Upon principle and authority, no recovery on the contract could be had in that case. .
We think the trial court did not err in refusing to grant an injunction and its decision is affirmed. The respondents to recover the costs of this appeal.
Bronson, Ch. J., and Christianson, Nuessle, and Birdzell, JJ., concur.