
    Peter A. Delaney, Respondent, v. Charles Miller, Jr., Appellant.
    
      Undertaking given upon an appeal from, a judgment of the City Court of Albany — counterclaim, — when not demurrable — an undertaking is a contract — Code of Civil Proa. §§ 501, 503.
    The legal title to any right of action on an undertaking, given upon an appeal from a judgment of the City Court of Albany, where the appellant was unsuccessful upon such appeal, is in the respondent, against whom the appeal was brought, and for whose indemnity the undertaking was given.
    While the attorney for such respondent has a lien for his costs upon the judgment, and any available security for its payment, yet, so long as the legal title to the undertaking remains in the respondent, an action at law can be maintained by him on such undertaking. In such action, if prosecuted in the respondent’s name, any valid defense to a recovery existing between the original parties to the undertaking may be interposed by the defendant therein.
    By an assignment of the undertaking to the attorney of such respondent, the right of the original obligee passes to the attorney, added to which is his lien for services, but until the value of such services is liquidated and ascertained it cannot, as matter of law, be said that it is sufficient in amount to equal the defendant’s liability on the undertaking, when such undertaking is given as well to secure damages as costs, and any valid defense, as to any excess of claim or obligation existing between the original parties, will be good as against the assignee of the undertaking..
    A pleading setting up any valid defense by way of counterclaim to the claim on the undertaking not covered by such attorney’s lien, which would have been available as between the original parties to the undertaking, is not demurrable if interposed as against such attorney to whom the rights of such respondent in such undertaking have been assigned.
    An undertaking given on the making of an order of arrest or on an application for an attachment, or for an injunction, and all of that class of undertakings given to indemnify a party in the progress of an action, may be regarded as contracts within the meaning and intent of sections 501 and 503 of the Code of Civil Procedure, and in an action thereon a counterclaim may be interposed although the party is not voluntarily connected with the obligation which he seeks to enforce.
    Appeal by the defendant, Charles Miller, Jr., from an interlocutory judgment of the Supreme Court in favor of the plaintiff, entered in the office of the clerk of the county of Albany on the 22d day of January, 1894, upon the decision of the court rendered at the Albany Circuit sustaining the plaintiff’s demurrer to the counterclaim contained in the defendant’s answer, and also from the order upon which said judgment was entered.
    
      Wm. T. Mwrra/y, for the appellant.
    
      Peter A. Pelcmey, for the respondent.
   Mayham, P.. J.:

This action is brought upon an undertaking signed by the defend ant as surety on an appeal from a judgment of the City Court of Albany to the Albany County Court, on the trial of which the appellant was defeated, and judgment was entered against him for costs only, on which judgment execution was issued and returned wholly unsatisfied.

The respondent in whose favor the judgment on appeal was entered assigned the judgment to this plaintiff, who is an attorney of this court, and was the attorney for the respondent on the appeal, and who claims in the complaint in this action that he has not been paid for his services as attorney.

The answer admits the execution of the undertaking, and denies all other allegations of the complaint. As a second defense the answer alleges an indebtedness from the plaintiff to the defendant in the action which he seeks to counterclaim against the alleged liability on the undertaking in suit. To the separate defense and contention the plaintiff interposes this demurrer upon the ground that it is insufficient in law upon the face thereof.

The legal title to any right of action on this undertaking was clearly in the respondent, against whom the appeal was brought, and for whose indemnity it was given. And while the attorney of the respondent had a lien for his costs against the judgment, and all available security for its payment, yet so long as the legal title to the bond remained in the respondent an action at law could be maintained by her on such bond, and in such action, if prosecuted in her name, any valid defense to a recovery existing between the original parties to the undertaking might be interposed by the defendant.

By the assignment to the plaintiff in this action the right of the original obligee passed to him, added to which was his lien for services, but until the value of such services were liquidated and ascertained it could not as matter of law be said that they were sufficient in amount to equal the defendant’s liability on the undertaking, which was as well for damages as costs, and any valid defense as to any excess existing between the original parties would be good as against the assignee of the bond.

It would seem to follow that, as to any valid defense to the claim on the bond, not covered by the plaintiff’s lien, which would have been available between the original parties to the undertaking, would not.be demurrable, when interposed as against the plaintiff who holds as assignee.

We are thus brought to the consideration of the question as to whether an undertaking like the one in suit is a contract.

Whether the counterclaim is allowable as pleaded in this case, must, we think, be determined under the provisions of section 502 of the Code of Civil Procedure. Subdivision 1 of that section is as follows: If the action is founded upon a contract which has been assigned by the party thereto, other than a negotiable promissory note or bill of exchange, a demand existing against the party thereto, or an assignee of the contract, at the time of the assignment thereof, and belonging to the defendant in good faith before notice of the. assignment, must be allowed as a Counterclaim to the amount of the plaintiff’s demand, if it might have been so allowed against the party or the assignee, while the contract belonged to him.”

The only question, therefore, for us to determine in passing on the demurrer is whether this action is founded upon a contract.. The learned judge who sustained this demurrer at the Special Term put his decision upon the case of Furber v. McCarthy (18 N. Y. Civ. Proc. Rep. 69). In that case the defendant, who was sued on an undertaking given by him on an order of arrest, sought to counterclaim a note held by'him against the obligee in the undertaking, and. the court, by Yan Brunt, J., held that the undertaking was not a contract within the provisions of section 502 of the Code. In that decision the court relied upon the authority of MoCoun v. N. Y. C. & H. R. R. R. Co. (50 N. Y. 176), and adopted the definition therein given of a contract to be “ A drawing together of minds until they meet, and an agreement is made to do or not to do some particular thing.” The opinion above referred to is in direct opposition to the decision of the General Term in the second department in Atwater v. Spader (12 N. Y. St. Repr. 506), where it was held, Dykman, J., writing the opinion of the court, that in an action upon an undertaking given on an order of arrest, the defendant might counterclaim an indebtedness to him from the obligee under the provisions of sections 501, 502 of the Code of Civil Procedure.

This decision was not referred to by Yan Brunt, J., and the two decisions of equal authority stand directly opposed to each other.

Under these circumstances, we are called upon to determine in this case the same .question as to which they so radically differ.

Erom a careful examination and analysis of sections 501 and 502 and the decisions bearing upon their interpretation, we are inclined to the opinion that an undertaking given on an order of arrest on an application for an attachment, or for an injunction and all that class of undertakings given to indemnify a party in the progress of an action, may be regarded as contracts within the meaningxand intent of those sections.

Clearly an Undertaking is an agreement to do an act, the doing of which is a matter of personal interest and advantage to the promisee or obligee therein; and while there is no consideration of benefit to the promisor or obligor, when he signs only for the accommodation of the plaintiff, there is clearly a consideration of harm to the promisee if the obligation is not performed; such a consideration is deemed sufficient to uphold a contract, and although the party' to whom the obligation is given, and for whose protection it is made, may not be and is not a voluntary party to it, still, as in this case, he or his assignee may sue upon it and it inures to his benefit. (Lawrence v. Fox, 20 N. Y. 268.)

In Wickham v. Weil (43 N. Y. St. Repr. 155) the New York Common Pleas, at General Term, held that in an action against sureties on an undertaking given on an attachment, a counterclaim could be properly set up in the answer on the ground that such an undertaking was a contract within subdivision 2 of section 501 of the Code of Civil Procedure. In this case, Pryor, J., in an able and exhaustive review of all of the authorities, including Furber v. McGarthy (supra), reaches the conclusion that an undertaking required by statute and given in a legal proceeding in a civil action, is a contract which, when sued upon, is subject to counterclaim.

It is true that it has been held in McCoun v. R. R. Co. (50 N. Y. 176) that an action on a bond for a-penalty given by statute is not an action on contract. But there seems to be a manifest distinction between a bond given by statute for a penalty and a bond given in a proceeding by one party to another to indemnify the party for whose benefit it is given from some injury which he may suffer by reason of the acts of the other party to the action. (Coit v. Stewart, 50 N. Y. 17.)

In Taylor v. Root (4 Keyes, 335) "Woodruff, J., in discussing the right to interpose a counterclaim to an action on a judgment under a provision of the Code of Procedure substantially like the provision of the Code of Civil Procedure in question, defines contracts to be of three kinds, simple contracts, contracts by specialty, and implied contracts, and he adds: “ A judgment is a contract of the highest nature known to the law. Actions upon judgments are actions on contract. The cause or consideration of the judgment is of no possible importance.”

While this may not be an authority bearing directly upon the question of the bond under consideration, it is a plain indication that a counterclaim may be interposed in cases where the party is not voluntarily connected with the obligation which he seeks to enforce. We are of the opinion that the weight of authority is in favor of the contention that the bond in suit is a contract as to which a counterclaim may be properly interposed by answer, and that the judgment on demurrer must be reversed.

Putnam, J., concurred; Herrick, J., not acting.

Judgment reversed, with costs of the demurrer, and costs and disbursements of this appeal to the defendant, on the payment of which, within twenty days after notice of the taxation of same, the plaintiff' may reply to the answer.  