
    Merrimack,
    Dec. 3, 1901.
    Edgerly v. Hale.
    A sheriff is entitled to the following fees: For service of a writ npon the defendant, fifty cents; for service of a writ npon the trustee in foreign attachment, fifty cents ; for copies of writs, at the rate of seventeen cents for each page of 334 words or fractional part thereof ; for attestation of a copy of a writ, eight cents; for attestation of a copy of the return of an attachment of real estate, eight cents.
    A sheriff is not entitled to a fee for an attestation of the indorsement upon a writ, nor for service in making attachments of real estate and nominal attachments of personal property.
    The statute imposing a penalty for demanding and taking greater fees than those allowed by law implies a prohibition of the act punishable thereby ; and an agreement between a sheriff and an attorney for the payment of customary fees in excess of the legal amount cannot be enforced. An agreement between a sheriff and an attorney, limiting the personal liability of the latter to fees actually collected by him, is valid; but an agreement that a sheriff shall receive no fees from an attorney or his clients for the service of writs unless the actions result successfully is void as contrary to public policy.
    Where a sheriff and an attorney have agreed that no fees should be paid for the service of certain writs unless collections were made, and have stipulated for the payment of illegal fees if the actions resulted successfully, the. former cannot recover for the service of writs to which the contingency applied, nor can the latter recover sums paid in pursuance of the contract j but for the service of writs not included in the agreement, and for which, excessive charges have been made, the sheriff is entitled to the fees established by law, and the attorney may recover the amount paid by him in excess of the legal limit, or have it allowed upon a set-off in an action, against him.
    A sheriff may recover fees collected for him by an attorney to the extent of their legality, without regard to the illegal character of the agreement under which such collections were made.
    Assumpsit, for fees. The defendant filed a plea in recoupment, and a set-off for sums paid the plaintiff in excess of legal fees, during the period between October, 1893, and September, 1897-Facts found by a referee, and case transferred from the April term,. 1901, of the superior court by Peaslee, J. The plaintiff was. sheriff of the county and served writs for the defendant, who is. an attorney-at-law. Among the plaintiff’s charges are the following:
    
      For service of police and supreme court writs upon the defendants in actions, and if trustee writs, upon the trustees,— upon each, fifty cents.
    For a copy of a writ, if returnable to a police court, fifty cents ; and if to the supreme court, one dollar.
    For travel, twelve cents a mile, one way.
    It was customary for sheriffs to charge, and attorneys to pay,, fees at these rates.
    The evidence tended to prove that there was a special agreement between the parties by which the plaintiff was to be paid at the above rates for the service of all writs, with the exception of certain writs upon which no collections were made, and was to be paid nothing for the service of the latter. The defendant’s evidence tended to prove that the exception included all writs upon which no collections were made, whether police court or supreme court writs, and whether entered in court or not; while the plaintiff’s evidence tended to prove that it included only police court writs not entered in court. The referee ruled that if there was a, special agreement it was not binding because of the defendant’s refusal to pay more than statutory fees. Accordingly he allowed the plaintiff fees in all cases, whether collections were made or not, at the following rates: For the service of a writ upon the defendant in the action, fifty cents; for copies of police and supreme court writs, at the rate of seventeen cents for each page of 224 words, and if there was a fraction of a page, seventeen cents for that; for each of two certificates upon a copy of a writ, eight cents. Each writ contained 560 to 672 words. The plaintiff’s charges for nominal attachments of personal property, attachments of real estate, and service upon trustees were disallowed. The referee also disallowed the items in the defendant’s set-off for payments in excess of legal fees, because they pertained to an executed illegal contract.
    Subject to the defendant’s exception, judgment was ordered upon the report, modified by the disallowance of the fee for one of the two certificates upon copies of writs.
    
      Matthews Sawyer, for the plaintiff.
    
      Defendant pro se ; Martin f Ilowe, for the defendant.
   Chase, J.

1. The fees allowed by the referee for the service of writs upon defendants and for copies were in accordance with the statute. P. S., e. 287, ss. 16, 26. In making service of writs and other process, the officer is required to make use of attested copies. P. S., c. 219, s. 2; Ib., c. 220, s. 3. It is implied that he shall make the attestation himself, and such has been the uniform practice. He is a certifying officer -within the meaning of section 26, chapter 287, of the Public Statutes, and is entitled to charge the fees thereby prescribed. McGlure v. Locke, 61 N. H. 14; Laws, ed. 1815, p. 132. Formerly a certifying officer was allowed only twelve cents for a fraction of a page (G. L., c. 290, s. 3); but this limitation was omitted upon the revision of the statutes in 1891, and now the provision relates to units only, the same as the provisions relating to the travel and attendance of parties and witnesses. P. S., c. 287, ss. 8, 13. As in the latter cases, a fraction is regarded as a unit. Bedel v. Goodall, 26 N. H. 92.

2. The referee allowed for two certificates upon copies, and the court for only one. It is understood that one of the certificates related to the body of the writ, and the other to the filing and indorsement; and that it was the latter which the court disallowed. The attestations to the correctness of the copy of the body of the writ was required (P. S., c. 219, s. 2), and the charge for it is authorized by the statute. P. S., c. 287, s. 26. Original writs must be indorsed by the plaintiff if an inhabitant of the state; and if not, by some responsible person who is an inhabitant. P. S., c. 218, s. 8. The indorser is liable for the costs recovered by the defendant in the action. P. S., c. 218, s. 9. The indorsement is not a part of the writ, but is “in effect, a bond that the indorser will be responsible to the defendant hi certain emergencies.” Garvin v. Legery, 61 N. H. 153, 154. It is not included in the term, writ or process; and the requirement that an attested copy of a writ or process shall be given to, or left at the abode of, a person does not make it necessary that the copy shall have upon it a copy of the indorsement. White v. Taylor, 48 N. H. 284. There is no other statutory provision requiring an attestation of the indorsement; and if the charges disallowed were for such attestations the ruling was correct.

An attachment of real estate upon a writ of mesne process is made by the officer’s leaving an attested copy of the writ, “ and of his return of the attachment thereon,” at the dwelling-house or office of the town clerk of the town in which the real estate is situate; or if there is no town clerk, with the clerk of the supreme court of the county. P. S., c. 220, s. 3. The officer is entitled to charge for two certificates in such cases — one the attestation of the copy of the writ, and the other the attestation of the copy of the return of attachment. See Foster v. Hadduck. 6 N. H. 217. While the certificate might be made to cover both the writ and the return of the attachment, the statute does not require it to be so made, as was the case in the statute construed in Fowler v. Tuttle, 24 N. H. 9. If a charge of this nature was disallowed, the order should be modified to conform to this view.

3. The plaintiff’s charges of fifty cents for service in making-attachments of real estate were properly disallowed (McQlure v. Locke, 61 N. H. 14); also the charges for nominal attachments of personal property. P. S., c. 287, s. 17.

4. “ The trustee writ shall bo an attachment and summons, and shall bo served upon the defendant and trustee like a writ of summons.” P. S., c. 245, s. 3. The trustee action has a dual nature. Ingraham v. Olcock, 14 N. H. 243. In it there may be issues between the plaintiff and the trustee, as well as between the plaintiff and defendant. The defendant is commonly called “ principal defendant ” to distinguish him from the trustee; the trustee is, in a sense, a defendant. Weeks v. Billings, 55 N. H. 371, 373. If he die pending the proceedings, his executor or administrator may be summoned in “as a party.” P. S., a. 245, s. 4. The service upon the trustee also possesses a dual nature. It-constitutes an attachment of the defendant’s property rights in the possession of the trustee (Corning v. Records, 69 N. H. 890, 398), and is a summons to the trustee to appear and show cause why an execution should not issue against him. The attachment is an incident of the service. While a trustee may not create an attachment of the defendant’s property by an acceptance of service (Nelson v. Sanborn, 64 N. H. 310), there is no reason why such an acceptance would not bind the trustee, so far as his personal interests are concerned, if the act of summoning him could be severed from the act of attaching the defendant’s property. “ A trustee can waive his own but not the defendant’s rights.” Shelters v. Boudreau, 66 N. H. 576, 577. The writ contains two commands — one to summons the defendant, and the other to summons, the trustee (P. S., c. 218, s. 17); and an execution of the latter command, although it creates an attachment of tbe defendant’s property in the trustee’s possession, is no less a service of process upon the trustee than the like act is service of process upon the-defendant. Service upon the trustee is “ service ” of a writ ox-process within the meaning of the word as used in section 16, chapter 287, Public Statutes.

5. There was a special agreement between the parties by which the plaintiff was to be paid fees at specified rates for the service of writs, excepting certain ones upon which no collections were made, and was to be paid nothing for the service of the latter. The specified rates were, fifty cents for service upon each defendant and trustee, twelve cents a mile one way for travel to make-service, fifty cents for each copy used in making the service of a police court writ and one dollar if a supreme court writ, without regard to the number of words in the copy. According to the plaintiff’s testimony, the exception included only police court writs which, proved, not to be the means of enforcing collections; while according to the defendant’s testimony, it included all writs which proved unproductive of results. The extent of the exception is immaterial upon the question of the validity of the agreement. The material fact bearing upon this question is the proviso that no fees should be paid for the service of some writs if no collections were made thereby.

The agreement is for the service of each one of several writs for specified fees,— the obligation to pay the fees being conditional in some instances,— not an agreement for the service of a number of writs as a whole for a single, inseparable consideration. The promises of each party are several and distinct, and are supported by corresponding considerations.- If, for example, in the execution of the agreement, twenty writs were delivered to the plaintiff: for service, his promise was to serve the fifteenth writ, or any other one of the twenty, for the fees named, subject to the condition; and the defendant’s promise was to pay accordingly for that particular service. Carleton v. Woods, 28 N. H. 290 ; 2 Par. Con. 517.

The fees agreed upon are the same as those fixed by the statute excepting the fees for copies of writs, which, in the case of police court writs, are a trifle less than statutory fees if the writs contain 560 words at least; and in the case of supreme court writs, are larger if the writs contain no more than 67 2 words. At the time of the making of the agreement it could not be foreseen how many words the several writs to be served would contain; but it must he presumed that the plaintiff, being the sheriff of the county, and the defendant, being an attorney-at-law, had learned from their experience that the writs most frequently used, especially for collection purposes, did not contain a 'sufficient number of words to entitle an officer to one dollar for a copy, at the rate of seventeen cents for 224 words. The writs which the plaintiff served contained 560 to 672 words, and, including fee for certificate or certificates, would entitle him to charge fifty-nine or sixty-seven cents for each copy, instead of a dollar.

The statute provides that “ if any person shall demand and take a greater fee for any service than is allowed by law, or any fee to which he is not by law entitled, he shall forfeit fifty dollars for each offence to the person who will sue therefor.” P. S., c. 287, s. 32. The imposition of the penalty implies a prohibition of the act punishable thereby. Roby v. West, 4 N. H. 285; Pray v. Burbank, 10 N. H. 377; Lewis v. Welch, 14 N. H. 294; Williams v. Tappan, 23 N. H. 385, 391; Brackett v. Hoyt, 29 N. H. 264. The act that is prohibited and made illegal by the statute is the demanding and taking of greater fees than the law allows. The making of an agreement by which such fees are to be paid is not an offence so long as tlie agreement remains executory; but the moment it is executed, and the officer demands and takes the fees mentioned in it, he becomes liable for the penalty. Barker v. Bank, 61 N. H. 147. Such an agreement although not directly prohibited, cannot be enforced because the law will not aid in defeating itself.

The custom of sheriffs to charge, and attorneys to pay, one dollar for the copy of a writ containing a less number of words than would justify the charge under the statute, however long and uniformly followed, would not repeal the statute. “ An unlawful act cannot become lawful by usage.” Shattuck v. Woods, 1 Pick. 171; Cutter v. Howe, 122 Mass. 541; Concord v. Burleigh, 67 N. H. 106. The custom therefore is immaterial upon the question under consideration. The special agreement is void, so far at least as it provides for the payment of greater fees for copies than those allowed by the statute.

6. The statutes do not expressly prohibit sheriffs from making contracts by which the payment of their fees depends upon the contingency of success in the proceedings in which they are employed, but they do contain provisions which clearly recognize the existence of a public policy that conflicts with contracts of that kind. The nature and duties of the office of sheriff have a tendency to prove the existence of such a policy. The sheriff is a public officer elected by the people. Const., pt. II, art. 70; P. S., c. 25, s. 1. It is his duty to serve in his county, by himself or his deputies, all writs and other precepts to him directed issuing from lawful authority, excepting wits in actions in which he is a party, or is related to one of the parties, or is interested. P. S., c. 212, ss. 3, 4. If he refuses or neglects to perform the duty, his fees therefor being first tendered, he makes himself liable to a penalty. Ib., s. 7. He must perform the duty faithfully, impartially, and with reasonable care and diligence. As has been stated, the compensation for his service is in most instances fixed by the statutes, which also render him liable to a penalty if he demands and takes greater compensation. Any person having occasion for his aid in the service of legal process may command it by a delivery of the process and a tender of the prescribed fees ; no special agreement is needed.

Prior to 1867, the only tiling that disqualified a sheriff from serving process was the fact that he was a party to the action. II. S., c. 179, s. 3. Under this statute it was held that a sheriff could not make legal service of a process either in favor of or against the town of which he was an inhabitant. State v. Walpole, 15 N. H. 26. It was decided in a later case that no interest short of that arising from the fact that the sheriff was the nominal or real party to the suit would disqualify him. Barker v. Remick, 43 N. H. 235. One ground of the decision was the difference between the terms of the provision relating to the service of process, and the terms of the provision in the same section relating-to the returning of talesmen and attending upon a jury,— the disqualification for the performance of the former duty arising “ when the sheriff is a party,” and for the performance of the latter arising “ in all cases where the sheriff is a party interested, or related to either party.” The court said that the difference in the language “ is a strong argument against the existence of an intention to disqualify the sheriff in respect to the service of writs for the cause of interest or relationship, when he is not actually a party. Had such been the purpose of the legislature, no reason can be perceived for not expressing it distinctly, especially as it is so done in the other provision in regard to talesmen.” The decision was. rendered in 1861. Upon the enactment of the General Statutes-in 1867, these provisions were changed into their present form, namely: “ When the sheriff is a party, or related to either party, or interested in the suit, the writ shall be directed to and served by a coroner; and on the trial of the suit the coroner shall return talesmen and attend the jury, and shall have the powers and bn subject to the liabilities, in relation thereto, of the sheriff in like-eases.” G. S., c. 197, s. 4; P. S., c. 212, s. 4; Interest in the suit, except that arising from the sheriff’s being a citizen of a town or a member of a corporation which is a party (P. S., c 212, s. 6), now disqualifies him to serve process the same as it does to return talesmen and attend upon the jury. This legislation tends to prove the existence of a public policy that requires impartiality on the part of the officer who serves legal process — the same impartiality that is required of one who selects jurymen for the trial of a cause and guards them against outside influence while deliberating.

There is another provision having probative force in the same direction. “No sheriff or deputy sheriff, police officer, constable, or city marshal shall be suffered to appear in any court or before a justice as attorney for any party in a suit. Any writ, declaration, plea, complaint and warrant, or other process made by a sheriff, deputy sheriff, police officer, constable, or city marshal for another person, shall be void.” P. S., c. 212, s. 20. The object of' this statute was to prevent abuses likely to follow from rmiting in the same person the offices of sheriff and attorney. Osgood v. Norris, 21 N. H. 435, 437; Sawyer v. Wood. 59 N. H. 347. In Tandy v. Boioell, 54 N. H. 384, the writ was served by an attorney who had a special deputation from the sheriff; but it did not-appear that he made the writ or process used in the action, or acted as counsel in the case. There was therefore no ground for-pronouncing the writ void; but the court remarked that “ the practice of an attorney of the court accepting a special deputation to serve writs is not to be encouraged.” Among the abuses which the statute was designed to prevent was the bringing of actions as an experiment merely, and the making of speculative agreements in reference to the commencement and prosecution of actions. There is very little, if any, difference in the degree of danger in this respect between a case in which a person acting in the capacity of attorney makes a writ and, in the capacity of sheriff, serves it, and a case in which an attorney makes the writ and a sheriff serves it under an agreement by which the fees for service are contingent upon the success of the venture. If an attorney knew that neither he nor his client would be subjected to any expense for the service of the writ unless the fees were collected of the defendants, more actions would be brought. In other words, an attorney or a plaintiff having such an agreement with a sheriff would bring actions with the same freedom, and perhaps recklessness, that he would if he were also sheriff and could serve his own writs. Useless litigation would be promoted by such a practice, and in many instances the parties defendant, if not the plaintiffs, would be subjected to unnecessary expense and anxiety. It would have a strong tendency to disturb the peace of society, and so would conflict with public policy.

In Tool Co. v. Norris, 2 Wall. 45, 55, it is said: “Agreements for compensation contingent upon success suggest the use of sinister and corrupt means for the accomplishment of the end desired. The law meets the suggestion of evil, and strikes down the contract from its inception.” If such agreements are not in all cases suggestive of a contemplated use of fraudulent means, they at least have a tendency to subject the persons whose compensation is involved in them to the influence of selfish motives, and so, in the case of public officers, have a tendency to lead or crowd them from the path of duty. If the payment of a sheriff’s fees for the service of a writ is made dependent upon the success of the plaintiff in the action, the sheriff by such agreement acquires an interest in the action which differs from that of the plaintiff only in degree, and in some cases possibly not in that particular. The interest does not cease with the completion of the service of the writ, but continues and naturally prompts him subsequently to do whatever he may properly do, to say the least, to bring about a successful result. Generally, the defendant in the action would not be informed of the agreement, and would attribute all the acts of the sheriff to the performance of his official duty. The powers conferred upon sheriffs are liable to be used in such a manner as to cause oppression and extortion. To confine this evil to the smallest practicable limit, the law removes from sheriffs all temptations to misuse their powers. It regards the office not as a means for obtaining all the business possible, but as a trust to be administered faithfully, impartially, and according to law, without the hope of any other reward than that fixed by the statutes. Trist v. Child, 21 Wall. 441, 450. The law does not encourage sheriffs or lawyers to multiply actions for their benefit; but, on the other hand, makes it their duty to allow parties to take their own course in bringing actions.

“ There is neither a more wholesome nor a sounder rule of law than that which requires public officers to keep themselves in such a position as that nothing shall tempt them to swerve from the straight line of official duty.” Stropes v. Commissioners, 72 Ind. 42, 48. “ A contract which tends to the injury of the public ser-

vice is void, although the parties entered into it honestly and proceeded under it in good faith. The courts do not inquire into the motives of the parties in the particular case to ascertain whether they were corrupt or not, but stop when it is ascertained that the contract is one which is opposed to public policy; Nor is it necessary to show that any evil was in fact done by or through the contract. The purpose of the rule is to prevent persons from assuming a position where selfish motives may impel them to sacrifice the public good to private benefit.” Elkhart County Lodge v. Crary, 98 Ind. 238, 242; Brown v. Bank, 137 Ind. 655; Tool Co. v. Norris, 2 Wall. 45, 56; Richardson v. Crandall, 48 N. Y. 348; Hawkeye Ins. Co. v. Brainard, 72 Ia. 130; Willemin v. Bateson, 63 Mich. 309; Poll. Con. 286; Green. Pub. Pol. 338. If the agreement was that the plaintiff’s right to compensation for the service of certain writs should depend upon the contingency of success in the actions,— if he was to be paid nothing by the defendant or his clients for the service' unless the actions resulted successfully, — the agreement to that extent would be opposed to public policy, and would be illegal and void.

7. If the agreement related only to the defendant’s personal liability, it would not be affected in this way. Prior to the act of 1899 (Laws 1899, c. 20), an attorney was liable upon an implied promise for sheriff’s fees if he delivered writs to a sheriff for service without giving notice that he would not be liable; and this, -although he is regarded as the agent of a disclosed principal. Towle v. Hatch, 43 N. H. 270. The officer in such case has the right to elect to whom he will look for his fees — the attorney or his client. Joyce v. Morgan, 66 N. H. 487. Therefore, if the agreement between these parties was that the defendant should not be liable for the fees unless he collected them, but that the plaintiff should look to the defendant’s clients for his pay, it would not conflict with public policy. The defendant could properly avoid personal liability in that way; and a provision of that nature would not render the agreement illegal and void.

8. Some of the items of both the plaintiff’s specification and the defendant’s set-off undoubtedly relate to the service of writs other than police court writs not entered in court, for which the plaintiff is entitled to pay under the agreement without regard to the success of the actions, if his testimony is believed; and others relate to the service of police court writs not entered in court, for which he is not entitled to pay unless collections were made in the actions. In other words, according.to the plaintiff’s testimony the contingency as to payment has no relation to some of the items, ■and of course cannot affect the rights of the parties in respect to them, even if it is opposed to public policy. As to items of this nature, if any, in the defendant’s set-off, his light to recover sums paid by him in excess of statutory fees depends solely upon the question whether the parties, by violating the provisions of section 32, chapter 287, Public Statutes, previously quoted,— the plaintiff by demanding and taking illegal fees, and the defendant by paying them, — ■ are in pari delicio.

The statute imposes the penalty upon only one of tlie parties to the transaction — the one who demands and takes the fee; the person who pays the fee is not punishable. See State v. Rand, 51 N. H. 361, 364; M. & L. Railroad v. Railroad, 66 N. H. 100, 131. The evil of the act prohibited consists in its liability to lead to oppression and extortion. The purpose of the statute was to protect persons requiring the services of public officers against this evil. Fox v. Whitney, 33 N. H. 516. In Browning v. Morris, 2 Cowp. 790, Lord Mansfield stated the law with reference to the criminality of the parties to such a transaction, and the right of the party who pays to recover back the sum paid, as follows: “The rule is,' In pari d,elicto, potior esi conditio defendentis. . . . Where the contract is executed and the money paid in pari delicto, this rule . . . certainly holds; and the party who has paid it cannot recover it. For instance, in bribery, if a man pays a sum of money by way of a bribe, he can never recover it in an action, because both plaintiff and defendant are equally criminal. But where contracts or transactions are prohibited by positive statutes for the sake of protecting one set of men from another set of men, — the one, from their situation and condition, being liable to be oppressed or imposed upon by the other,— there the parties are not in pari delicto; and, in furtherance of these statutes, the person injured, after the transaction is finished and completed, may bring his action and defeat the contract. For instance, by the statute of usury taking more than five per cent is declared illegal, and the contract void; bnt these statutes were made to protect-needy and necessitous persons from the oppression of usurers and moneyed men, who are eager to take advantage of the distress of others; whilst they, on the other hand, from the pressure of their distress, are ready to come into any terms, and, with their eyes-open, not only break the law, but complete their ruin. Therefore, the party injured may bring an action for the excess of interest.” See, also, Smith v. Bromley, Doug. 696, n; Williams v. Hedley, 8 East 378. These principles have frequently been recognized and applied in this state. Willie v. Green, 2 N. H. 333; White v. Hunter, 23 N. H. 128; Prescott v. Norris, 32 N. H. 101, 105; Cross v. Bell, 34 N. H. 82; Weeks v. Hill, 38 N. H. 199, 205; Welsh v. Cutler, 44 N. H. 561; George v. George, 47 N. H. 27, 44; Hall v. Costello, 48 N. H. 176; Johnson sv Ferris, 49 N. H. 66; Butler v. Northumberland, 50 N. H. 33, 38, 39; State v. Rand, 51 N. H. 361, 368; Souhegan Nat’l Bank v. Wallace, 61 N. H. 24, 26; Ladd v. Barton, 64 N. H. 613. The demanding and taking of fees by a sheriff in excess of those allowed by law falls, within the latter class of transactions, and the person paying the-same may revoke the payments and recover the excess in'an action of assumpsit, or have it allowed upon a set-off in a like action against him, imless the foregoing rule of law is rendered inoperative by some other rule. Walker v. Ham, 2 N. H. 238; Burnham v. Aiken, 6 N. H. 306; Albany v. Abbott, 61 N. H. 157.

The plaintiff says the payments were made under a mistake of law, and for this reason cannot be recovered back. It is a general rule that a person voluntarily paying money under such a mistake-cannot recover it back, although he was under no legal obligation to-make the payment. Strafford Savings Bank v. Church, 69 N. H. 582, and authorities cited. But an application of the rule to cases-of this kind would frequently defeat the purpose of the statute. It is probably true that persons who pay illegal fees to officers are. generally mistaken as to their legal liability. They naturally assume that officers would not demand more than they are entitled' to. There is no reason why such persons should stand in a worse position than persons who yield to the extortionate demands, although having accurate knowledge of their rights. A payment of fees under a mistake of law must be regarded as an exception to the general rule, “in furtherance of these statutes,” for the same reason that a person paying with knowledge that he is aiding in the violation of a positive prohibition of the statute is regarded as not in pari delicto.

If the contract was as the plaintiff alleges, the defendant is entitled to an allowance upon his set-off of all sums therein specified which were demanded and taken from him by the plaintiff in. excess of legal fees, within six years prior to the date of the writ (Peterborough Savings Bank v. Hodgdon, 62 N. H. 300; Cummings v. Knight, 65 N. H. 202; Ashland Savings Bank v. Bailey, 66 N. H. 334), for the service of writs other than police court writs not entered in court.

Upon the same supposition, the plaintiff is entitled to recover legal fees for the service of writs other than police court writs not entered in court. In the performance of his duties as a public officer he rendered services at the defendant’s request, waiving the prepayment of his fees. Presumably, there was nothing illegal in the services themselves. The special agreement provided for the payment of legal fees in all cases save one, and in that provided for the payment of a larger sum. The defendant certainly cannot object because he is called upon to pay a less sum than lie promised. As has been previously stated, it is the demanding and taking of illegal fees that is punishable — not the making of a contract to that end. There is nothing in the statutory provisions tending to show an intention on the part of the legislature to deprive an officer of his legal fees because he demanded a larger sum. The well-established rule that the injured party may recover only the excess of his payment over legal fees conclusively ■shows that the law regards the officer as entitled to the latter, notwithstanding his illegal act. If after the wrong has been done an officer may retain the portion of the money received by him which represents legal fees, a fortiori, he may recover legal fees before the wrong is consummated. The plaintiff, therefore, is entitled to recover legal fees for the service of all writs to which the condition in the special agreement does not apply. According to his testimony, this would be all writs excepting police court writs not entered in court; and according to the defendant’s testimony it would be none, for the condition applied to all alike.

The effect of the condition upon the rights of the parties as to the items of both the plaintiff’s specification and the defendant’s set-off to which it applies remains to be considered. In what follows, the condition is treated as of the nature which conflicts with public policy. Neither party occupied a position in which he could compel or unduly influence the other to agree to a provision by which the sheriff should have no compensation unless the actions were productive of collections. Such an agreement could not have been made without the active and voluntary cooperation of both parties. Presumably, the defendant was as fully aware of its illegality as the plaintiff was. There is no view of the matter in which one of the parties can be regarded as more innocent than the other. They were in pari delicto. Consequently, the plaintiff is not entitled to recover upon the agreement for the service of writs to which, the contingency applied; neither can the defendant, recover of the, plaintiff any sums that he has paid for services of that nature. The law will leave both parties where it finds them. The exception to the general rule, by which the defendant is-allowed to recover of the plaintiff sums paid to him in excess of legal fees when the illegality of the transaction arises solely from a violation of the statute, does not apply. The objectionable provision is prohibited by public policy, not for the purpose of protecting one of -the parties to the contract against oppression and imposition by the other, but for the purpose of protecting parties against whom actions are brought, and insuring a faithful and impartial administration of justice. The public, as well as the parties to the contract, have an interest in the matter. It would not be “ in furtherance of ” the public interests to allow the party paying money under such circumstances to recover it or any portion of it back. Neither is the plaintiff entitled to recover, upon an implied promise, legal fees for services rendered under the objectionable provision. Butler v. Legro, 62 N. H. 350. There . being an express .promise in regard to that matter, one cannot be implied.

10. There is a further question in case the defendant has collected fees for the plaintiff and has not paid them over. Is the defendant liable to the plaintiff for the money so collected, as for money had and received to the plaintiff’s use, upon an implied promise? Portsmouth Brewing Co. v. Mudge, 68 N. H. 462, is an authority directly in point. The plaintiffs in that case were engaged in the illegal sale of intoxicating liquors in this state, and the defendant was their treasurer and received the money accruing from the illegal business. ' There was a shortage in his-accounts, and he promised to pay the same within thirty days after the amount of it was determined by a person named. He did not pay, and the action was brought upon his promise. It was held that he was hable without regard to the illegal character of the business in which the money was acquired. In the course of the opinion the. court say: “ When an illegal contract has been executed by the parties themselves, and the illegal object of it has been accomplished, the money or thing which was the price of it may be a legal consideration between the parties for- a promise, express or implied, and the court will not unravel the transaction to discover its origin.” In the present case, as in that, the plaintiff can prove-a case for the recovery of fees collected by the defendant,, entirely independently of the illegal contract. M. & L. Railroad v. Railroad, 66 N. H. 100, is another case in point. Upon the authority of these cases, the plaintiff may recover of the defendant the money collected by the latter as fees for the plaintiff to tbe extent of tlieir legality, notwithstanding the agreement under which the writs were served was illegal because of its conflict with public policy. If the sums so collected by the defendant amount to more than legal fees, the excess belongs to the parties who paid the same and not to the plaintiff. It is only the legal fees that equitably belong to him. He could not take more without incurring the penalty before mentioned. The law will not aid him in doing that.

It is manifest that the rulings of the referee in regard to the special agreement were not in accordance with these views; and for this reason, as well as for the other reasons above stated, the judgment must be set aside and there must be a new trial.

Case discharged.

Walker, fl., did not sit: the others concurred.  