This is. an appeal from an order overruling a demurrer to the complaint, the ground of the demurrer being that such complaint fails to state facts sufficient to constitute a cause of action.
The complaint is too lengthy to incorporate in this opinion, nor do we deem it necessary so to do in order to intelligently present the points of attack made against it. The facts briefly stated are as follows:
At the general election held in Richland county on November 8, 1910, the defendant Frank Heley and one George E. Moody were opposing candidates for the office of sheriff; Moody receiving 1,513 votes, and Heley 1,502 votes, according to the official canvass; that thereupon the said canvassing board duly declared Moody elected, and a certificate of- election in due form was issued to him by the county auditor.
On December 12, 1910, Heley served upon Moody a notice of election contest, wherein he alleged, in substance, that he, and not Moody, had received a plurality of the legal votes cast at said election, and that he, and not Moody, was duly elected to said office; thereafter Moody duly served his answer to said notice of contest, putting in issue all the allegations contained in such notice, and alleging generally that he, Moody, was in truth and in fact duly elected to such office. In January, 1911, said contest was tried, and in February the court made and filed its findings of fact and conclusions of law in Moody’s favor, and judgment was given and entered accordingly, and notice of the entry thereof duly served upon the attorneys for the contestant, Heley. No appeal was taken therefrom, and at the expiration of sixty days the same became final and irrevocable.
Moody duly qualified for said office, and on January 4, 1911, demanded possession thereof from Heley, who was then in possession, having been elected thereto at the general election of 1908. Heley refused to surrender possession of the office, and on January 5, 1911, Moody instituted mandamus proceedings against Heley to oust him from such office, basing his claim upon his prima facie right to the *279office by virtue of the certificate of election. An answer and return to the alternative writ of mandamus was interposed, and said mandamus proceedings duly tried, and the district court, on February 6, 1911, duly made an order that a peremptory writ of mandamus issue against said Heley, and on February 1, 1911, a peremptory writ was issued and such notice thereof duly served upon the attorneys for the said Heley.
Upon the entry of judgments in the said contest case and the said mandamus proceeding, Heley applied for and obtained a supersedeas order in both cases, under which Heley was given the right to retain possession of said office pending an appeal to the supreme court from the judgments entered therein; upon this application it was stipulated, in open court, that the office of sheriff was worth, net, $300 per month to the incumbent thereof, which stipulation was made for the purpose of fixing the value of said office in order to avoid further controversy in any subsequent proceeding regarding the question of the value of said office. Pursuant to the conditions of said order, the defendants executed the undertaking sued upon.
No appeal was taken in the election-contest case, but an appeal from the judgment in the mandamus proceeding was taken, and subsequently such appeal was in all things dismissed. The undertaking sued on was given in the contest proceeding, no reference being made therein to the mandámus case.
Pursuant to the order of the court granting to him a stay of proceedings and a supersedeas upon the giving of the undertaking, Heley remained in possession of the said office, and appropriated to his own use all the fees, compensation, and emoluments of the same up to the second day of May, 1911, when he surrendered and turned over to Moody the said office. Heley has not paid or caused to be paid to Moody, or any other person, any sum of money, or other thing of value, in discharge of his said obligation to pay to the said Moody the sum of $300 per month, net, for and during the time which the said Heley held and occupied said office after the entry of said judgments.
For a valuable consideration Moody duly assigned, transferred, and set over to plaintiff all his rights under said bond, as trustee, for the benefit of the said plaintiff and other persons.
Did the lower court err in overruling such demurrer? Appellants’ counsel argue, with much skill and vehemence, that it did, while re*280spondent’s counsel contend with, equal ability and earnestness to the contrary. As we understand the contentions of appellants’ counsel, they, in brief, are that the order granting the supersedeas in the contest case conditioned upon the execution and filing of the supersedeas undertaking sued on was not within the power and authority of the court to make, and consequently such undertaking is not legally enforceable, as such order furnishes no valid consideration therefor,.even though by reason thereof Heley was permitted to retain possession of the office and has received the emoluments thereof. The basis for such contention is, in the language of counsel, “that it is against public policy to in any way transfer the possession of a public office, or to assign the avails, fees, salary or emoluments thereof.”
Counsels’ contention, in other words, is predicated upon the assumption that the effect of the transaction by which such order was made and the undertaking given amounts to a contract in the ordinary sense of the term, to which contract Moody is a party, and by the terms of which he agreed, in consideration of the undertaking, to permit appellant to remain in and to perform the official duties of such office, collecting and appropriating to himself the fees and emoluments thereof. Such a contract, if made, would concededly be void as against public policy.
Eespondent’s counsel, for the purposes of this appeal, admit that the court improperly made the supersedeas order aforesaid, but they contend that such order is not void, but merely erroneous. They also assert that the same was made by the court over Moody’s protest, and that in no sense can he properly he charged with even consenting thereto. In other words, respondent is not in the position that he would be in had Moody voluntarily entered into a contract permitting appellant to remain in the office in consideration of his giving such undertaking. After mature deliberation we find ourselves unable to concur in the views entertained by appellants’ counsel. We think the basic fallacy of their contention is quite apparent on mature reflection. Moody can, in no proper sense, be charged with a violation of the rule of public policy referred to. There was no contract entered into by him in contravention of such rule. The court, by its concededly erroneous order, and not Moody, made it possible for ITeley to retain such office, and the court was led into such error presumably by the *281persuasive argument of Heley’s attorneys. In view of this, and more especially after Heley has reaped the benefits of such order, is there any sound reason based on public policy or otherwise, why he or his sureties should be permitted, in a court of law, to reverse such position, and there assert as a defense to a suit on the undertaking that Heley, even in good faith, led the court into error in issuing a void order, and as a consequence that the undertaking given pursuant thereto is a nullity and without consideration? We know of no such rule, and the argument in support thereof is contrary to our sense of natural justice and fair play. Having succeeded in persuading the-court to issue the order, neither Heley nor his bondsmen will be heard to urge the invalidity thereof as a reason for escaping liability on the undertaking. The authorities cited and relied on by appellants’ counsel to the effect that estoppel cannot be relied on as a reason for preventing a defense to an illegal contract, or one entered into in violation of the rule of public policy, are not in point, as Moody entered into no such contract. He had no alternative in the matter, but was forced to take what the court deemed proper to give him, and he was given the undertaking in lieu of the office. Wherein, therefore, can he be charged with a breach of any rule of public policy ? As before stated, respondent does not base his right of recovery upon any contract which Moody was instrumental in bringing about, but solely upon a quasi contract brought into existence by the court. But appellants, in effect, say that Moody should, or at least could have ignored the supersedeas order thus made and have brought a proceeding to oust Heley from such office. Granting that he possessed such right, does it necessarily follow that he was bound to do this or lose all his rights? We think not; nor do we think any court has ever extended the rule of public policy to such extent. As an ordinary law-abiding citizen would do, Moody recognized and abided the court’s mandate, refraining, as he had a lawful right to do, from incurring the risk of contempt of court by ignoring and treating such order as a nullity. Must he suffer by so doing ? Clearly not. He did not, by such conduct, become a party to any contract contravening public policy or otherwise, and the numerous authorities cited by appellants’ counsel have no applicability whatever to the facts here presented. To say that Moody, by the transaction in question, in effect assigned the avails of the office during *282the period he was kept out of the same, is farfetched and unfounded. Such assumption is predicated upon the false theory that in some manner Moody entered into a contract to this effect. We can spell out of the facts no such conclusion.
Again, appellants’ counsel assert that “Heley had possession of the office of sheriff when Moody had the certificate of election and a judgment determining that he (Moody) was elected,” and they inquire, “Could Moody become legally entitled to the stipulated avails — $300 a month — while Heley held the office and did the work?” and they proceed to answer such question by saying that “we submit again that, under the laws of North Dakota, no one can legally draw or receive the fees or emoluments of a public office, directly or indirectly, by order of the court or otherwise, except he be in possession or perform the duties thereof.” Such is not our understanding of the law; but, even granting this to be correct, still Heley being an intruder or usurper, we think he would be under a legal duty to account to Moody for the fees and emoluments thereof collected by him, and such we understand are the authorities. See cases cited in note to Andrews v. Portland, 10 Am. St. Rep. at p. 284. Also Woodruff, Quasi Contr. 636 ; Kreitz v. Behrensmeyer, 149 Ill. 496, 24 L.R.A. 59, 36 N. E. 983 and cases therein cited ; Booker v. Donohoe, 95 Va. 359, 28 S. E. 584.
It is no doubt settled by the weight of authority that where a de facto officer has collected the salary or fees during his incumbency, the de jure officer cannot maintain an action against the county or other municipality to enforce payment of the same to him. El Paso County v. Rhode, 16 L.R.A. (N.S.) 794, and note. He may, however, recover the same from the de facto officer. No rule of public policy forbids his doing the latter. On the contrary, a sound public policy favors this. Kreitz v. Behrensmeyer, supra. This being true, what principle of sound public policy forbids a recovery upon a bond given to secure the payment thereof under facts like those here presented ? We know of none.
Furthermore, we are agreed that respondent’s counsel are correct in asserting that appellants, under the facts, are, and on the plainest principles of justice should be, estopped from urging the defense which they here urge. Heley, by virtue of the supersedeas, obtained on his application, was permitted to remain in the office and to receive the *283fees and emoluments thereof. The undertaking sued on was given as a condition to granting him this privilege, and he ought not to he heard at this time to contend that such undertaking was without consideration, and is null and void. Love v. Rockwell, 1 Wis. 383 ; Clark v. Miles, 2 Pinney (Wis.) 432 ; Gudtner v. Kilpatrick, 14 Neb. 347, 15 N. W. 708 ; Stevenson v. Morgan, 67 Neb. 207, 108 Am. St. Rep. 629, 93 N. W. 180 ; Ferguson v. Landran, 5 Bush, 230, 96 Am. Dec. 350 ; Daniels v. Tearney, 102 U. S. 415, 26 L. ed. 187 ; United States v. Hodson, 10 Wall. 395, 19 L. ed. 937 ; 16 Cyc. 787-790.
The United States Supreme Court in Daniels v. Tearney, 102 U. S. 415, 26 L. ed. 187, uses language which is applicable to the case at bar, as follows: “Not to apply the principle of estoppel to the bond in this case would, it seems to us, involve a mockery in judicial administration and a violation of the plainest principles of reason and justice.”
We readily concede the correctness of appellants’ contention that, where a contract is void as against public policy, a person who has accepted a benefit thereunder will not be estopped to defend against such contract in an action brought to enforce the same; but this exception to the rule of estoppel has no application under the facts in the ■case at bar, for the obvious reason, as we have heretofore observed, that Moody is in no way responsible for the undertaking in question ■or the supersedeas order, nor can it be said that he consented thereto. The court granted the same against Moody’s protest.
Nor is there any merit in appellants’ contention that the bond never became operative, because no appeal was in fact ever taken in the ■contest case. The undertaking, when construed in the light of the supersedeas order therein referred to, plainly provides for the payment to Moody of the sum of $300 per month during the time he shall be kept out of the office by reason of the granting of such supersedeas.
After duly considering all of appellants’ contentions and the authorities relied on by them, we are impelled to the conclusion that the complaint is not vulnerable to the attack made upon it, and the order appealed from is accordingly affirmed.