In this case plaintiff, Fisher, a justice of the peace, brings an action against the defendants, Lane and Dob-kins, to recover statutory fees alleged to be due to the plaintiff as justice of the peace. From a judgment for the defendants, the plaintiff appeals.
In his first cause of action, the plaintiff sets forth his capacity as justice of the peace and alleges that the defendants were copartners doing business as the Corvallis Credit Bureau, and conducting a collection agency in the city of Corvallis, Oregon. The plaintiff then alleges that between the 1st day of April, 1933, and the 29th day of April, 1935, at the special instance and request of the defendants, he performed services in his capacity as justice of the peace, consisting of filing civil actions in said court, issuing summons, writs and attachments, and executions, setting cases for trial and conducting trials and hearings. He sets forth a list of the cases so filed in exhibit A attached to the complaint, and alleges that by virtue of the services so performed by plaintiff for defendants there became due to the plaintiff from the defendants the sum of $135, no part of which has been paid. He alleges that that amount is now due and owing, and seeks judgment for the same.
The fees claimed in the first cause of action are those which are alleged to have been earned under the provisions of Chapter 86, Oregon Laws of 1933, p. 93, which statute was in effect until amended by Chapter 309, Oregon Laws of 1935, p. 475.
For the second cause of action, plaintiff makes similar allegations, but in it he seeks to recover for fees *441alleged to have been earned between May 1, 1935, and July 1,1938, a list of the cases being set forth in exhibit B. Upon the second cause of action he claims the sum of $1,235.25. The fees set forth in the second cause of action are those alleged to have been earned under the provisions of Chapter 309 of the laws of 1935. The itemized statements, exhibits A and B, attached to the complaint, set forth the date of filing, name and amount of the fees in the respective cases.
The defendants answered separately, but the substance of both answers may be covered in a single summary. The defendants deny the allegations of the complaint except the formal ones concerning the official status of the plaintiff and the partnership of the defendants. The affirmative defenses are, as stated by the defendants, “similar in effect.” They allege in substance that the plaintiff, prior to the time of filing any cases in the justice court, agreed to waive payment of the statutory fees allowed by law and to release the defendants of all liability therefor, and agreed to accept in full compensation “such sums as defendants realized and received in each individual ease for the payment of said case.” Under the alleged agreement, plaintiff was not to receive any fees for services to be rendered by him for the defendants as such justice “unless and until defendants had collected and received, by reason of such action, from, or in behalf of, the defendant or defendants in such action so filed with plaintiff, sufficient moneys to cover and pay such respective fee charge of plaintiff therein.” It is alleged that defendants accepted such offer and by way of consideration, it is further alleged that the defendants promised and agreed with plaintiff “that they would file -with the plaintiff, as such justice of the peace, many *442such actions which would otherwise be filed elsewhere, and that they would pay to plaintiff from and out of any such moneys so collected and received by them in any such action so filed with plaintiff, sufficient therefor, such contingent fee charge of plaintiff in and for such respective action.” It is further alleged that pursuant to the alleged contract the defendants “filed several actions (most of which defendant could have, and would have, filed elsewhere but for such contract), including all those so mentioned and described in” exhibits A and B. It is alleged that the foregoing matters are the same as those of which plaintiff complains in plaintiff’s first and second causes of action. It is further alleged in the answer of defendant Dobkins, who was formerly M. L. Lane and is now Mrs. M. L. Driscoll, that the amounts agreed upon have been paid to the plaintiff, that no funds have been realized by defendants in the cases listed in the exhibits to the complaint, that there has been a “complete and final settlement of all sums due the plaintiff pursuant to said agreement,” (italics ours) and that there is nothing due the plaintiff from any of the causes mentioned in the exhibits. The answer of the defendant Lane does not contain the last above mentioned allegation. (It is apparently omitted upon the theory that the plaintiff is bound by the contract alleged in the answers and since the plaintiff has not alleged compliance with that contract or the performance of the conditions on which payment was to depend, the plaintiff could not recover.)
The plaintiff denied the new matter set forth in the respective answers. In so far as the answers of the defendants differ, the defendants being partners, we shall for the purposes of this opinion assume that both *443defendants have joined in those allegations of the answers most favorable to their position.
The case was tried by the court without a jury, four different circuit judges participating in the proceedings at different stages thereof. The demurrers of the plaintiff to the answers of the defendants were overruled. After the filing of replies denying the affirmative allegations, the plaintiff moved for judgment on the pleadings for the reason that the answers filed failed to state a defense to plaintiff’s complaint. The motion was denied. After trial, the court made and entered general findings for the defendants. Judgment for the defendants was thereupon entered and plaintiff appeals. A purported bill of exceptions and transcript of the testimony appears in the files, together with an order of the court to the effect that the proposed bill, having been tendered too late, was disallowed. Under these circumstances, this court will only consider whether the respective answers constituted valid defenses to the plaintiff’s complaint and are sufficient to support the general finding in favor of the defendants.
If we should disregard the contracts set forth in the answers, it is clear that the plaintiff, upon proof of his allegations, would be entitled to judgment for the fees earned by him as justice of the peace under the provisions of the statutes which were in force at the times when the respective fees were earned. The affirmative answers of the defendants rest solely upon the special contract. The question for decision relates, therefore, to the sufficiency of the affirmative defenses assuming, in view of plaintiff’s demurrer, that the special contract as alleged was made and that under its provisions, if *444valid, no fees were dne or owing to the plaintiff at the time of filing the complaint.
We shall first inquire concerning the validity of the special contract upon which the defendants rely. In the statute which was in force during the entire period of this controversy, it is provided as follows:
“Justices of the Peace * * * shall collect in advance, except in criminal cases, from all litigants the fees now allowed by law.” O. C. L. A. § 27-212.
Under this statute, it is not only a right, but a duty of the justice of the peace in all civil cases to collect the statutory fees in advance.
A bargain of one who holds public office, the emoluments of which are fixed by law, whereby he agrees to take less than legal compensation, is contrary to public policy and void. School District No. 1 v. Teacher’s Retirement Fund, 163 Or. 103, 95 P. (2d) 720, 96 P. (2d) 419, 125 A. L. R. 720; DeBoest v. Gambell, 35 Or. 368, 58 P. 72.
“A bargain for either increasing or diminishing compensation fixed by law for a public official is illegal.” 2 Restatement, Contracts, §565, p. 1070; 6 Williston, Contracts, § 1730, p. 4886; 70 A. L. R. 793.
If the statutory emoluments of non-judicial public officers cannot be validly reduced by agreement, a fortiori the same rule should be applied to judicial officers.
“A, a commissioner entitled by law to certain fees, bargains with B, a party to a hearing before A, not to charge fees unless costs are recovered by B. The bargain is illegal, and though costs are not recovered by B, A can recover his legal fees. ” 2 Restatement, Contracts, § 565, p. 1071, illus. 4; Watson v. Pales, 97 Me. 366, 54 A. 853.
*445“Conduct of Judiciary. With respect to agreements that involve considerations which may affect the impartiality of a magistrate, public policy requires that they shall be declared void, and they are equally futile as the basis of an action or of a defense. The law applies the general principle to all agreements which embody this potential danger to the public interests. No agreement is valid which makes the payment of fees to a judicial officer in any way dependent on his decision between the parties. Accordingly, an agreement that a judicial officer shall receive no compensation for his services unless the party is successful or until he collects from his adversary is against public policy and void. * * *” 12 Am. Jur. § 187, p. 689. And see Pitsch v. Continental and C. Nat. Bank, 305 Ill. 265, 137 N. E. 198, 25 A. L. R. 164.
Contracts which make the compensation of a judicial officer dependent upon the outcome of the case to be decided by him, tend to pollute the fountain of justice at its source. To recognize such an agreement as valid would, in effect, permit a judge to become an interested party in cases tried by him. Under the agreement set forth in the answers of the defendants, the compensation of the justice would have depended, in part at least, upon the rendition by him of orders and judgments favorable to the plaintiff..
Performance of such a contract would trench upon, if it did not actually invade, the constitutional right to a fair and impartial trial on the part of persons against whom suits might be brought in the justice court. The decision of the United States Supreme Court in Tumey v. Ohio, 273, U. S. 510, 71 L. Ed. 749, 47 S. Ct. 437, 50 A. L. R. 1243, while not directly in point, is highly persuasive. In that case, pursuant to statute and ordinance, jurisdiction was vested in the mayor .of a city *446to try criminal prosecutions for the violation of the liquor law. Upon conviction of a defendant, the mayor, as judge, might be entitled to costs in the amount of $12. The only source from which the fees of the mayor could be derived was the fine imposed upon the defendant in the event of his conviction. The Supreme Court by Chief Justice Taft reviewed the authorities, English and American, from Bonham’s case, 8 Coke 118A, 77 Eng. reprint, down to modern times. It was held that a person convicted under the foregoing provisions was denied due process of law under the Fourteenth Amendment. And see 12 Am. Jur. § 635, p. 326. We hold that the special contract set forth in the affirmative answers was against public policy and void.
Our next inquiry is whether the plaintiff is barred from recovery in this action by reason of the illegal contract to which he was a party. Defendants in their brief assert that the plaintiff “under the pleadings in this case, is in no position to urge that any sum of money is owing to him by respondents, or either of them, under or pursuant to the contract pleaded in the respective answers * *' *.” (Italics ours.) It is the position of the plaintiff that he is not seeking to recover “under or pursuant to the contract pleaded in the respective answers.” So far at least as his complaint is concerned, it is true that he relies solely upon his right to recover fees prescribed by statute. The complaint contains no reference to the special contract or to any part of it. Therefore, cases in which the plaintiff pleads a contract which is void as against public policy and seeks to recover thereon are not in point.
We recognize that plaintiff may sometimes be barred from recovery even though his pleading does not *447disclose any illegality, if the essential facts upon which he bases his case depend upon the illegal transaction. 2 Paige, Contracts, § 1103; Brown v. New Jersey Insurance Co., 140 Or. 547, 14 P. (2d) 272. But here the plaintiff need not prove or rely upon any portions of his illegal contract in order to support his statutory claim.
“Even though the parties to an action have been engaged in a transaction either malum in se or prohibited by law, if the cause of action between them is disconnected from the illegal act and is founded upon a distinct and collateral consideration, and the plaintiff is not obliged to resort to the illegal agreement or transaction in order to maintain the suit, the illegality of the former transaction will not impair or bar the right to maintain the suit. If the contract or obligation does not depend upon, or require the enforcement of, the unexecuted provisions of the illegal agreement, it will be carried out. The test is whether the agreement sought to be enforced can be separated from the illegal acts or agreements relied upon as avoiding it and whether the plaintiff requires any aid from, or must in any way rely upon, the illegal transaction in order to establish his case. As to the ability of the plaintiff to make out his cause of action without referring to the illegal agreement, it may be stated that the plaintiff for such purpose cannot refer only to the legal portion of the agreement upon which he proposes to found his right of action, but that the whole of the agreement must be brought in. But an illegal agreement made by a plaintiff will not defeat him unless his cause of action is founded upon, or arises out of, such agreement. His right to recover upon a ground of action that exists independently of the agreement is not affected thereby. * * *” 12 Am. Jur. 719, § 211, Contracts.
*448Applying this broad doctrine, it is said by the editors of A. L. R.,
*1 The rule in most jurisdictions is that, a contract by a public officer to render services for a compensation less than that fixed by law being invalid, such officer may recover the legal salary or fees therefor. ” 70 A. L. R. 976, citing many cases.
The doctrine which denies recoveries to a plaintiff who is in pari delicto is subject to a well recognized exception.
“If refusal to enforce or to rescind an illegal bargain would produce a harmful effect on parties for whose protection the law making the bargain illegal exists, enforcement or rescission, whichever is appropriate, is allowed.” 2 Restatement, Contracts, § 601, p. 1116.
“* * * In some instances, however, a sound public policy may demand either the enforcement of an executory illegal bargain, or the rescission of an executed one, when a denial of such relief by the courts would work a forfeiture disproportionate to the social interest supporting the public policy, or result in harm to those for whose protection such bargains are declared illegal.” 6 Williston, Contracts, rev. ed. § 1762, p. 5002; and see id. at § 1787, p. 5081; 116 A. L. R. 1018, anno.
An apt illustration of the general principle is stated by Professor Williston as follows:
“* # # Thus, for the security of depositors and others, banks are prohibited from entering into certain kinds of loans or purchases. When a transaction of this sort has been entered into, however, should the corporation be refused a right of recovery the result would be the impairment of the assets of the bank — the very result which the law seeks to prevent, and, therefore, the bank is allowed to recover. * * *” 5 Williston, Contracts, rev. *449ed. § 1632, p. 4573; 116 A. L. R. 1018, anno.; Darnell-Love Lumber Co. v. Wiggs, 144 Tenn. 113, 230 S. W. 391.
We are not concerned alone with the plaintiff and defendants in this case. The public interest imperatively requires that all parties filing suit in courts of justice shall be treated with equal impartiality. To allow special pecuniary concessions to one plaintiff while denying it to the others, is to place the court on the level of an auctioneer. To make the compensation of the justice dependent upon the success of plaintiffs over defendants in a litigation, would place the court beneath that level.
There is another reason for recognizing the right of the plaintiff to recover his statutory fees notwithstanding his participation in an unlawful contract. Our statute provides that each justice of the peace shall make a monthly accounting of fees collected for the previous month, “and all fees in excess of $200 collected for the previous month shall be forwarded with said itemized statement * * * and said fees shall be credited to the general fund of the county.” O. C. L. A. § 27-213.
We have no way of knowing the amount of fees at the statutory rate which may have been payable to the justice on account of litigation brought in his court by the defendants and by all other litigants, but we do know that the county has a contingent interest in the excess over $200 collected in any one month and that it is the duty of the justice to collect the fees and render monthly accounting to the end that the rights of the county may be protected. The special contract did not merely waive the private rights of the justice of the *450peace, it attempted ineffectually to waive rights of the public.
We have examined the cases of Bradfeldt v. Cooke, 27 Or. 194, 40 P. 1, 50 Am. St. Rep. 701; Ah Doon v. Smith, 25 Or. 89, 34 P. 1093; Moreland v. Devenney, 72 Kan. 471, 83 P. 1097; Peters v. City of Davenport, 104 Iowa 625, 74 N. W. 6; Ridgway v. Wetterhold, 96 Kan. 736, 153 P. 490, all cited in respondents’ brief, and find them clearly distinguishable from the ease at bar. In Willemin v. Bateson, 63 Mich. 309, 29 N. W. 734, decided in 1886, the court held that a contract similar to the one involved here was a “palpable violation of judicial duty” and void, but it also held that the plaintiff could not recover, the “whole transaction being covered by the same taint. ’ ’ In that case the county had no interest in the collection of the fees as is the case here, but in any event we decline to follow the Michigan decision.
The defendant relies strongly upon DeBoest v. Gambell, supra, and the similar case of Chandler v. City of Elgin, 129 Or. 558, 278 P. 581. In the first mentioned case, DeBoest brought mandamus to compel the payment to him of the full amount of his legal salary. The defense was a special agreement to receive less than legal compensation.' The court held the special contract void as against public policy. The answer alleged that the plaintiff had received and accepted the stipulated sum in full payment of all demands against the city. This allegation was admitted by the plaintiff’s demurrer. The demurrer to the answer was sustained by the trial court and the question on appeal related to the sufficiency of the answer. The court held that where the salary had been earned, no principle of public policy is violated by his voluntary acceptance of an amount less than that provided by the statute. It appeared from the pleadings that the illegal trans*451action was fully executed, the plaintiff having accepted the stipulated payment each month in full settlement. The plaintiff was denied recovery.
Concerning this situation, we quote from 6 Williston on Contracts:
“* * * If the agreement is executed by the payment of the diminished emoluments, there are decisions holding that no further claim can be made, [citing DeBoest v. Gambell, supra] But the opposite view, also supported by authority, seems better. A debt has accrued which cannot be surrendered by parol without consideration.” 6 Williston, Contracts, rev. ed. § 1730, p. 4887.
The essential distinction between the DeBoest case and the one at bar lies in the fact that the one relates merely to compensation of a fire chief and the other to the integrity and impartiality of a judicial officer. Furthermore, in the case at bar, the illegal contract was not fully executed. The account had not been closed. The defendants plead that no funds have been realized by the defendants in the cases listed in the complaint, but so far as the record shows, funds may yet be realized in the actions listed. Even under the terms of the special contract, if valid, plaintiff would be entitled to fees if and when the defendants as plaintiffs in collection cases should realize from the persons against whom suits have been brought.
Under these circumstances, the defendants cannot avail themselves of the equitable principle of estoppel by asserting that they filed cases in the plaintiff’s court' in reliance upon an illegal and executory contract. The case falls within the noted exception to the rule which bars recovery to plaintiffs who are in pari delicto. The testimony is not before us. Although the facts appear *452to be generally conceded, the pleadings which alone we have considered show general denials to some of the material allegations of the parties. We hold that the affirmative answers of the defendants failed to state any defense to the allegations of the complaint.
The judgment is reversed and the cause is remanded for a new trial.
Mr. Justice Kelly dissents.