The contest before us is between the defendant, Sullivan, and the intervener, Voss. The action is upon an undertaking executed by defendant, Sullivan, to plaintiff, Clark, as surety for one Mead, against whom Clark had recovered judgment before a justice of the peace. From this judgment, Mead appealed to the District Court, and on this appeal the undertaking sued upon was executed by Sullivan, as surety for Mead. In this undertaking, Sullivan, in substance,' agreed that he would pay the *282amount of any judgment which should be rendered against Mead, in and by the District Court, on such appeal. Judgment having been recovered by Clark against Mead in the District Court, he (Clark) brought this suit against defendant, Sullivan, upon the undertaking.
As a counterclaim to the plaintiff’s cause of action, defendant, Sullivan, interposed a judgment recovered against plaintiff, Clark, in favor of Fairbanks, Morse & Co., which judgment was assigned to Sullivan before the commencement of this action. That such judgment constitutes a valid counterclaim, as against Clark, cannot be disputed. Wells v. Henshaw, 3 Bosw. 625; Clark v. Story, 29 Barb. 295; Pom. Rem. & Rem. Rights,-§ 799. But the intervener, Voss, who was allowed to serve a complaint in intervention, insists that the judgment can be interposed as a counterclaim against plaintiff’s cause of action on the undertaking only to the extent of plaintiff’s interest in that cause of action, after deducting therefrom the amount of an alleged attorney’s lien which he (Voss) insists he had upon the plaintiff’s cause of action against Sullivan, and upon the undertaking at the time Sullivan purchased the judgment against Clark. Had the attorney such a lien? And, if so, what is the nature of that lien? These are the questions which it is important for us to determine.
The attorney’s claim to a lien grows out of the following fact: Mr. Voss was attorney for Clark in the action against Mead. In that action he rendered services for Clark in both courts, worth the sum of $45. After the recovery of the judgment against Mead in the District Court, Mr. Voss entered his notice of lien to the sum of $45 in the judgment docket, opposite to the entry of the judgment. Under our statute, this gave him a lien, but what did it give him a lien upon?' The language of our statute leaves no room for construction upon this point. The statute, so far as it is material to this inquiry, provides as follows: “An attorney has a lien for a general balance of compensation in and for each case upon: * * * Third. Money due his client, in the hands of the adverse party, or attorney for such party, in an action or *283proceeding in which the attorney claiming the lien was employed, from the time of giving notice in writing to such adverse party, or attorney for such party, if the money is in the possession or under the control of such attorney, which notice shall state the amount claimed, and, in general terms, for what services. Fourth. After judgment in any court of record, such notice may be given, and the lien made effective against the judgment debtor, by entering the same in the judgment docket, opposite the entry of the judgment.” Comp. Laws,'§ 470, subds. 3, 4. It is plain from this language that the lien is not upon the judgment, as the principal thing. The lien is upon the money due the client, in the hands of the adverse party. That lien, before judgment, can be secured by serving notice as prescribed by subd. 3 of the section. After judgment it can be secured by making the entry therein provided for. But the lien is the same in either case. It is a lien upon the money due, and not upon the judgment itself. After judgment has been recovered, that lien can be secured only by making this entry, unless the notice required by subd. 3 has already been given. In casé that notice has been given it is possible that no further notice would be necessary, so far as the judgment debtor is concerned. Whether it would suffice, as against a third person, having no actual notice, it is not proper to determine in this case. But whether notice is given under subd. 3, or an entry is made under subd. 4, of § 470, the lien is primarily upon the money due, and not primarily upon the judgment itself. Winslow v. Railroad Co., (Iowa,) 32 N. W. Rep. 330. In this case, however, the intervener is compelled to insist that he has a lien upon the judgment, and upon the undertaking signed by Sullivan, and upon the cause of action upon such undertaking. Defendant, Sullivan, is seeking to set off the judgment against plaintiff, which he has purchased, against plaintiff’s claim arising out of the undertaking. It is obvious that Sullivan’s right to have this set off allowed is absolute, if the undertaking is owned by plaintiff, and no one else has any interest in it. The statute confers upon him a legal right to defeat plaintiff’s cause of action by *284interposing this judgment as a counterclaim. Sections 4914, 4915, Comp. Laws. The intervener can maintain his claim to priority, as against this judgment, in one way only. He must show that to the extent of his lien for services he is, in equity, the owner of plaintiff’s cause of action on the undertaking. If he became such owner before Sullivan’s right to set-off the judgment accrued to him, and Sullivan had notice of his rights at the time he (Sullivan) bought the judgment against plaintiff which he seeks to set off, then we are of opinion'that, to the extent of the intervener’s lien, the 'judgment does not constitute a proper counterclaim.
What were the rights of the intervener with respect to this undertaking, and the cause of action thereon against Sullivan? We are clear that he had all the rights with regard to this instrument that he had with respect to the judgment against Mead in favor of the plaintiff.' This undertaking was executed by Sullivan in the very case in which the judgment was rendered, and in the undertaking Sullivan promised to pay any judgment which the District Court might render in the case. The undertaking is but an additional security, provided for by the law, for the payment of the money due from Mead to the plaintiff. The lien which attaches to the money must necessarily attach to the undertaking. The money which Sullivan is to pay under this undertaking is the money which the attorney has secured for his client by the labor he has bestowed upon the original case. Nor is authority wanting to support our views. Newbert v. Cunningham, 50 Me. 231; Hobson v. Watson. 34 Me. 20; Martin v. Hawks, 15 Johns. 405; Wilkins v. Batterman, 4 Barb. 48. The reasoning upon which these cases rest is that the rights of an attorney, under his lien, are those of an equitable assignee of the judgment, to the extent of his lien. Under our statute he would be the equitable assignee of the money due from the debtor to the creditor. Of course, as such assignee, he would have the same interest in any undertaking or cause of action which the creditor, his client, might have, as security for the payment of such money. The *285intervener being, fo the-exteat of his lien, the equitable assignee of the plaintiff’s claim for money due him from Mead, he was also, to the same extent, the equitable assignee of the undertaking given by Sullivan on the appeal. It is a familiar principle that the assignment of the principal thing cairries with it all incidents. Our Code so declares, in express terms. Section 3243, Comp. Laws. In Hobson v. Watson, 34 Me. 20, the attorney had recovered a judgment for his client.' Upon this judgment he had a lien for his services. The debtor in the judgment gave a poor debtor’s bond, under the statute, to secure his release from execution issued upon the judgment. The client claimed the right to discharge the bond without the consent of the attorney. This the attorney contested, and it thus became necessary to determine whether the attorney had the same lien upon the bond which he had upon the judgment. The court decided that he did have such lien upon the bond, saying: “Does the lien extend to the bond in suit, and embrace it? The attorney has an interest in the judgment, to the amount of more than half of it. What is the nature of that interest? It is the property in it, to the extent of such interest, as much as if the creditor had assigned it to him as collateral security for his fees and disbursements; and, it being the property of the attorney, he has all the legal incidents which, attach to it, and which by law may arise from it. He could not claim a right to the benefit of any contract made between the creditor and debtor in relation to the mode of satisfying the judgment, when it was voluntarily entered into, and not prescribed by law. The debtor has the right, without the consent of the creditor, to give a bond to release himself from arrest in execution. It does not depend upon the will of the creditor. It is a legal incident attached to the judgment and execution. The creditor is compensated by the bond for the liberation of the debtor. The bond belongs to the owner of the judgment. If the whole amount due upon the judgment was costs, upon which the attorney had a lien, would not he be entitled to the control of the bond? It would be his property, in equity, and he would have a *286right to use the name of the nominal.i/Atly in a suit upon it.” In Newbert v. Cunningham, 50 Me. 234, the defendant in a replevin suit recovered judgment Lor return of the property. The execution upon this judgment being returned unsatisfied, the defendant who had recovered die judgment brought suit upon the replevin bond. He obtained a judgment upon this bond, but, the sureties being insolvent, ho sued the sheriff for taking an insufficient bond. This last' action was settled by the plaintiff therein without the ^eonsent of his attorney in the original replevin suit, in which the plaintiff recovered judgment. The attorney, claiming a lien for his services upon the original judgment in the replevin action, insisted that he had a lien to the same extent upon the cause of action against the sheriff for taking an insufficient bond, and that, therefore, the action could not be settled without his consent, to the prejudice of such lien. The court sustained him in this contention, saying: “The attorney, being regarded as an equitable assignee of the judgment, has a right to the same remedial processes as his client to obtain satisfaction to the extent of his lien. The replevin bond is a substitute for the property replevied, and a security for the damages and costs arising in the prosecution of the suit. The right to enforce it is one _ of the fruits of the judgment. It accrues after its rendition. It is by its enforcement that the judgment is made available. The attorney, as incidental to the jugment, has a light to enforce it, which his client cannot defeat. The bond is made running to the defendant in replevin. The attempt to collect it was ineffectual. The sureties were insolvent. But this will not discharge the sheriff. Until the attempt was made, and failed, he might have insisted it would have been successful. It being the duty of the sheriff to take a replevin bond with sufficient sureties, he is liable in case of their insufficiency. But to whom? Manifestly, to the person to whose benefit the bond, U good, would accrue. The damages awarded for taking an insufficient bond are the compensation for the loss arising therefrom. The person holding the bond is the one who suffers from the insolvency of the sureties. *287The defendant in replevin would primarily be entitled to the damages arising from an insufficient bond, if he obtained judgment, and as a consequence thereof. But the lien of the attorney is equivalent to an assignment of the judgment. The attorney, having a right to enforce the bond, has a right to the damages which may be given for and on account of its insufficiency. The assignment of the judgment carries with it the replevin bond, and the right to enforce it, and, in case of failure to collect, the right of action to damages by way of compensation for such failure. The assignor has no right to the suit. The action exists by virtue of the judgment, and as a mode of making it available, or of affording an adequate remedy to, the party suffering through the neglect of the officer; and that judgment, to the extent of his lien, belongs to the attorney.”
That the rights of the attorney, under his lien, are those of an equitable assignee, is supported by many decisions, and is sound on principle. Warfield v. Campbell, 38 Ala. 527, 534; Ely v. Cooke, 28 N. Y. 365; Perry v. Chester, 53 N. Y. 240; Marshall v. Meech, 51 N. Y. 140; Rooney v. Railroad Co., 18 N. Y. 368. The intervener therefore became an equitable assignee of this undertaking, to the extent of $45, his bill for services, several days before the defendant, Sullivan, had secured the right to set off the judgment against Clark. He (Sullivan) did not purchase this judgment until about a week after the intervener entered notice of his lien upon the judgment docket. But unless Sullivan had notice of this equitable assignment at the time he bought the judgment against Clark, his right to set off such judgment against his liability on the undertaking cannot be defeated by such assignment. Section 4871, Comp. Laws, provides: “In the case of an assignment of a thing in action, the action by the assignee shall be without prejudice to any set off or other defense existing at the time of, or before notice of, the assignment; but this section shall not apply to negotiable promissory note or bill of exchange, transferred in good faith, and upon good consideration, before due.” Under the terms of this section the right to set off a claim *288purchased by the debtor before notice of the assignment of the claim against the debtor, is unaffected by the assignment, although the assignment is made before the right of set off accrues to the debtor. Natchez v. Minor, 9 Smedes & M. 544; Lockwood v. Bates, 1 Del. Ch. 435; Bank v. Balliet, 8 Watts & S. 311; Martin v. Wells, Fargo & Co’s Express, (Ariz.) 28 Pac. Rep. 958. The statute only embodies a well established doctrine of the common law.
That defendant, Sullivan, had actual notice of the equitable assignment of the cause of action against him on the undertaking to Voss before he (Sullivan) purchased the set off, is not pretended. It only remains to be considered whether the entry of the lien in the judgment docket constituted notice to him. When we examine the statute, we find that it limits to the judgment debtor the effect of this entry as notice. It says that by this entry the lien is made effective against the judgment debtor. It is apparent that the statute does not mean that anylien is created against the judgment debtor,'or against his property, but merely' that the entry of the notice constitutes notice to him, so that he cannot thereafter disregard the interests of the attorney in the moneys which he (the debtor) owes the client The legislature has so restricted the operation of this entry of notice that only the judgment debtor is affected by it. His surety, on an appeal undertaking is not within the statute. The attorney can protect himself by giving such surety actual notice of his lien, and from that moment the surety pays the client, or purchases a set off against him, subject to the attorney’s rights. The case of Hroch v. Aultman & Taylor Co., (S. D.) 54 N. W. Rep. 269, has been cited to support the priority of the attorney in the case. But in that case the right of set off was held by the court not to be absolute, as in the case at bar. Here the defendant is' relying upon a legal set off which he purchased against the plaintiff’s cause of action against him, without notice that an equitable assignment of the. defendants claim had been made to the “attorney, whereas in that case the court was dealing with the question *289of the right of a judgment debtor to set off against the judgment obtained against him another judgment recovered by him against the plaintiff in the first named judgment. The court held the right to set off one judgment was not an absolute right, under the statute, but that the court would be governed by circumstances in granting or denying the'application to set off mutual judgments. That the right was not absolute, under the decisions, cannot be doubted. The application to have judgments set off was in the nature'of an appeal to the equity of the magistrate. When it would defeat justice to grant the application, it was refused. To the extent that the setting off of one judgment against another would affect the rights of third persons — rights which have equitable claim to superiority — the court will refuse to compel the payment of one of these judgments with the other. Puett v. Beard, 86 Ind. 172; Thropp v. Insurance Co., 125 Pa. St. 427, 17 Atl. Rep. 473; Dichl v. Friester, 37 Ohio St. 473; Brown v. Hendrickson, 39 N. J. Law, 239. See cases cited in note to Duncan v. Bloomstock, 13 Am. Dec. 730. Our statute'regulating this matter is the same as that of South Dakota. It provides that “mutual final judgments may be set off pro tanto, the one against the other, by the court, upon proper application and notice.” Section 5109, Comp. Laws. Whether we should agree with the Supreme Court of that state in the view that this statute works no change in the former doctrine, it is not necessary now to decide. It is sufficient to distinguish the case from that state, relied on by the intervener, that the court held that in that jurisdiction the court will exercise its discretion on an application to set off judgments, and will grant or withhold relief according to justice, having regard to those rights of third persons which will be affected by the granting of such relief. The right of the defendant to interpose this judgment against plaintiff as a counterclaim is absolute, under the statute, he having purchased the same before notice of the intervener's equitable interest in the undertaking. The order *290sustaining the demurrer to the complaint in intervention is affirmed.
(55 N. W. Rep. 733.) All concur.Note — For right of offset by surely, see Clark v. Sullivan, 2 N. D. 103.