It is contended on the part of the defendant that the purpose of the bond made by him to the plaintiff was merely to indemnify the latter against any claim which might be made by Wagner, and the costs and damages resulting to him from the assertions or prosecution of any claim made by Wagner upon the South Carolina judgment, and that it is entitled to such construction, and therefore the bond cannot support an action to recover the costs or expenses incurred by the plaintiff in defence of the action brought against him by the defendant.
The terms of that instrument do not seem to so limit its operation and effect. In the condition of the bond is first described the claim against which the plaintiff is indemnified; it then proceeds to indemnify him against all costs and damages which he should be compelled to pay by reason *160of the Wagner action or claims upon which it was based. The claim in view and mentioned was the South Carolina judgment. The indemnity seems to have embraced such costs and damages as the plaintiff should be subjected to not only in that action, but by reason of any claim made against him, founded upon such judgment. The relation of the defendant assumed to it was such as to enable him to control the judgment, and he undertook to relieve the plaintiff from its effect as a cause or claim against him for prosecution and its consequences. This would seem to include within its purpose, as represented by its terms, the protection of the plaintiff against the costs and damages resulting to him from the prosecution by any person having the apparent title to it of any claim founded upon the judgment. Such has been the effect given to it by adjudication which is controlling here upon that question. It appears that after the discontinuance of the Wagner action against the plaintiff in the supreme court of this State, the then plaintiff in that action assigned the judgmentto one Beecher, who brought an action upon it against the defendant which the latter defended. The discontinuance of that action was procured by the defendant, and thereupon the plaintiff brought against him an action on this bond of indemnity in the city court of New York, to recover the costs or expenses of defending the Beecher action and recovered. That judgment remains effectual, and must here be deemed to have conclusively established as between these parties that the liability of the defendant upon the bond was not limited to such costs and damages as the plaintiff should incur in the prosecution of the elaim of Wagner, but included such as should arise from the prosecution of it by any other party having the apparent title to it. Doty v. Brown, 4 N. Y. 71; Castle v. Noyes, 14 Id. 329; Pray v. Hegeman, 98 Id. 351. The conclusion would seem to follow that the operation of the bond extended to the action prosecuted upon the judgment by the -defendant against the plaintiff so as to *161afford to the latter the indemnity for such costs and damages, if any, which he reasonably incurred in excess of the costs recovered in such action.
It is alleged in the answer that the action so brought by the defendant against the plaintiff came on to trial and that the complaint was dismissed on the ground that the $500 paid to and taken by the defendant upon the compromise pursuant to which the bond was made had not been paid or tendered back to the plaintiff. That was the necessary result of an action brought upon the judgment, because its support by the defendant was dependent upon the rescission of the agreement constituting the compromise, which could be done for the purpose of an action at law only by tender of restoration by the defendant of that which he had received from the plaintiff. The record of that action is not here, but by the pleadings and evidence in the present case it appears to have been an action upon the judgment, and that the allegations of fraud on the part of the plaintiff in obtaining the settlement and bond were intended to furnish a reason for its support. The alleged cause of action there was different from that set forth in the defendant’s answer in this action by way of counterclaim. And for that reason the recovery there would have been no bar to the latter if the dismissal had been on the merits, Stowell v. Chamberlain, 60 N. Y. 272; but it does not so appear. Code, § 1209. The evidence offered by the defendant with a view to prove the alleged fraud was excluded, and exception taken. The question, therefore, arises whether the matter alleged constituted a counterclaim within the statute, which provides that it must be a cause of action against the plaintiff tending to diminish or defeat his recovery, arising out of the contract or transaction set forth in the complaint as the foundation of the plaintiff’s claim, or connected with the subject of the action. Id., § 501.
It is alleged in the answer that the defendant was in*162duced to make the compromise and give the bond of indemnity by the falsé and fraudulent representations of the plaintiff, made, in the manner stated, with the intent to deceive him, and that as the consequence of such fraud on the part of the plaintiff the defendant sustained damages for which he demanded judgment. This alleged cause of action of the defendant arose out of the transaction or contract of which the bond set forth in the complaint as the foundation of the plaintiff’s claim was the product, and the making of it constituted a part, and such cause of action alleged by the defendant comes within the meaning of a counterclaim as defined by the statute. Litchult v. Treadwell, 7 W. Dig. 83; affirmed 74 N. Y. 603; Carpenter v. Manhattan Life Ins. Co., 93 Id. 552. The view of the general term was that as the situation remained the same as it was when the complaint in the action of the defendant •against the plaintiff was dismissed, the alleged counterclaim was not available for the reason then existing for the disposition made of that action. It seems to have been assumed that the restoration of the amount paid by the plaintiff to the defendant was essential to the right of the latter to assert such counterclaim. That would have been so if it had been an alleged cause of action upon the South Carolina judgment, as its support would have been dependent upon rescission of the agreement which produced the bond, but the asserted counterclaim is a. cause of action founded solely upon alleged fraud, for which the defendant seeks to have allowed to him the damages he sustained by it.
In making this claim the defendant does not proceed in disaffirmance of the agreement of compromise. That, and the bond of indemnity remain effectual, subject only to his claim for such" damages as he may legitimately have sustained by reason of the fraud with which he charges the plaintiff. For the purpose of such relief no restoration was essential. What the defendant received as the result of the *163agreement may be retained by him, and taken into consideration upon the question of damages in the event the claim for them is supported at the trial. Gould v. Cayuga County Nat. Bank, 99 N. Y. 333.
These views lead to the conclusion that the judgment should be reversed and a new trial granted, costs to abide the event.
All concur.
Note on “ Counterclaims under Subdivision 1, Section 501 of the Code.
There are two kinds of counterclaim authorized by the Code: One which can be pleaded only in an action arising upon contract, and another which may be set up in any action. Chamboret v. Cagney, 41 How. 125.
In an action arising on contract, the defendant may set up as a counterclaim any other cause of action arising also on contract express or implied. Andrews v. Artisans’ Bank, 26 N. Y. 301; Lignot v. Redding, 4 E. D. Smith, 285, and existing at the commencement of the action, against a plaintiff between whom and such defendant a several judgment maybe had in the action, and owned by such defendant at the time of the commencement of the action. Chambers v. Lewis, 11 Abb. 210; Van Valen c. Lapham, 13 How. 240, and due at set time. Rice v. O’Connor, 10 Abb. 262.
In any other action, any defendant may set up as a counterclaim against any one of the plaintiffs, between whom and himself a separate judgment might be had in the action. Briggs v. Briggs, 20 Barb. 477; Newell v. Salmond, 22 Id. 647, any claim existing in favor of such defendant against such plaintiff at the commencement of the action, and of which the defendant is the owner, provided, however, such claim is founded upon a cause of action arising out of the contract or transaction set forth in the complaint or is connected with the subject of the action.
Formerly the rule was that, in an action for a tort, a counterclaim, no matter whether arising on contract or based upon another tort, could not be allowed. But this rule has been so far modified as to allow the interposition of a counterclaim, in the full sense of the Code, whether arising on contract or based upon a tort in an action for a tort, whenever such counterclaim is founded upon a cause of action arising out of the transaction set forth in the complaint, as the foundation of plaintiff’s claim, or whenever it is connected with the subject of the action. As soon as the defendant brings himself within one or the other of these exceptions to the general rule, his right to counterclaim is perfect, irrespective of the form of plaintiff’s cause of action as set out in the complaint. This point has been expressly decided by the New York superior court, at general term, in *164Xenia Bank v. Lee, 2 Bosw. 694; 7 Abb. 372. See, also, to the same effect Brown v. Buckingham, 11 Abb. 387 ; 21 How. 190.
But the editor of Howard’s Practice Reports has stated that this dictum cannot be sustained on authority, but that, on the contrary, the authorities that bear on the question are decidedly adverse to this view.
In Pattison v. Richards, 22 Barb. 143, an action was brought for a tort. Defendant counterclaimed for breach of a contract made four years prior to the commission of the alleged tort and having no connection with the subject of the action.
So, in Donahue v. Henry, 4 E. D. Smith, 162, the action was for a tort. A proposed set-off was held inadmissible because it related to other property than the one forming the subject of the action.
In Barhyte v. Hughes, 33 Barb. 320, the action was for an assault and battery. The defendant set up, by way of counterclaim, an assault and battery committed upon him by the plaintiff prior to the one described in the complaint. The court held that the two occurrences were so independent of each other that they could not be disposed of in one action.
In Mayor, etc., v. The Parker Vein Steamship Co., 21 How. 299; 12 Abb. 300; 8 Bosw. 300, the action was on contract for the payment of rent. The counterclaim was for a wrongful conversion of certain fixtures. It neither arose out of the contract or transaction set forth in the complaint, nor was it connected with the subject of the action.
In Chamboret v. Cagney, ante, the object of the action was to recover damages, but the subject thereof was the trespass committed by the defendant. The counterclaim interposed was based partly upon plaintiff’s fraudulent concealment of property not taken by the defendant, and partly upon the failure of plaintiff’s title to property which was taken. But it was not connected with the trespass upon which the plaintiff relies, nor did it arise out of the transaction set forth in the complaint. Id.
In Moody v. Moody, 16 Hun, 189, one John Moody conveyed a lot to plaintiff who went into possession of the premises conveyed. She and her husband at the same time executed to said John Moody their bond and mortgage on the premises, to secure a portion of the purchase price. Subsequently the defendant received a deed of the same premises from said John Moody. This latter deed was recorded before that of the plaintiff. In an action brought to have the defendant’s deed adjudged to be void, the defendant, among other defenses, alleged that the conveyance to plaintiff was procured by means of fraud and circumvention, and, by way of counterclaim, demanded an avoidance of said conveyance. And it was held that the defendants might allege and prove, as a counterclaim, that the plaintiff’s deed was fraudulently procured, and ask to have the same set aside.
In O’Brien v. Garniss, 25 Hun, 446, an action was brought to obtain the construction of a last will and testament and to have the title and right of possession of certain lands therein devised adjudged to be in the plaintiff. The defendant, who was a trustee, set up in substance that he was a trustee duly appointed and authorized to execute the trust of the will, and, as a counterclaim, alleged in substance that the plaintiff, in violation of his rights as such trustee, had unlawfully collected divers *165rents arising'out of the trust property, converted the same to his own use and refused to account therefor. He prayed as affirmative relief, for a judgment in his favor for the rents so collected, and in effect that the trusts of the will and the rights thereunder he adjudicated in his favor.
In this case, the subject of the action was the construction of the will and the validity of the trust under which defendant assumed to act. The object was to declare the trust void, and that the plaintiff take title by devise free from the trust. The counterclaim sought to establish the trusts, and to compel an accounting to the trustee for money alleged to have been collected by the plaintiff in hostility to the trust. This counterclaim and relief were connected with the subject of the action within the meaning of the Code.
In Coit v. Stewart, 12 Abb. N. S. 216, the answer alleged that plaintiff agreed to act as defendant’s agent in the purchase of bonds, and to account for all money coming to his hands, but that, after receiving a specified sum, he would not account, etc., but appropriated the same to his own use, whereby he became indebted, etc., and demanded judgment in the sum specified. And it was held that the answer set up a cause of action on contract which constituted a proper counterclaim in an action on contract.
In Thompson v. Kessel, 30 N. Y. 383, it was held that a claim on the part of the defendant for the price and value of the identical goods which are the subjects of the action, is a cause of action arising out of the transaction set forth in the complaint as the foundation of the ifiaintiff’s claim, or is at least connected with the subject of the action, and is strictly a counterclaim within § 150 of the former Code.
In Thompson v. Sanders, 118 N. Y. 252, one Wagner recovered a judgment in South Carolina against the plaintiff in this action, of which the defendant herein was the beneficial owner, though he did not have the legal title. Subsequently Wagner brought an action in this state upon such judgment. Under a compromise agreement, plaintiff paid defendant $500 and the latter gave his bond, conditioned to indemnify and save plaintiff harmless against all claims set forth in the complaint in that action and against all costs and damages plaintiff may be compelled to pay, by reason of said action, or the claims upon which the same is based.
An action was brought upon defendant’s bond, to recover the costs and expenses incurred by the plaintiff in excess of those recovered in the action. Defendant set up as a counterclaim that he compromised with plaintiff, relying upon the truth of the allegations in his answer in the suit brought by Wagner in this state, and otherwise made by him; and that such allegations and respresentations were false and fraudulent, and asked to recover the damages sustained by reason of the fraud.
Upon this state of facts, the question arises whether the matter alleged constituted a counterclaim within the statute. This statute provides that it must be a cause of action against the plaintiff tending to diminish or defeat his recovery, arising out of the contract or transaction set forth in the complaint as the foundation of the plaintiff’s claim or connected with the subject of the action.
It was held that the alleged cause of action of defendant in this case *166arose out of the transaction or contract, of which the bond set forth in the complaint as the foundation of the plaintiff’s claim was the product, and that the making of it constituted a part, and that such cause of action, alleged by the defendant, comes within the meaning of a counterclaim as-defined by the statute. Litchult v. Treadwell, 7 W. Dig. 83; 74 N. Y. 603; Carpenter v. Man. L. Ins. Co., 93 N. Y. 552.
An action was brought, in Litchult v. Treadwell, ante, upon a promissory note given by one defendant and endorsed by the other defendants. The note was given in payment for a balance due on a purchase of certain personal property and an interest in a certain business, including the goodwill thereof. The defendant set up as a defense and counterclaim fraud and claimed damages on account thereof. It was held that the answer was sufficient for the recoupment and recovery of such damages.
In Carpenter v. Man. L. Ins. Co., ante, an action was brought to recover for the wrongful conversion of a quantity of cord-wood. The answer alleged that one Markham executed to the defendant a bond, and a mortgage as collateral thereto, to secure the payment to the defendant of a certain sum of money, with interest; that thereafter the defendant foreclosed the mortgage.and became the purchaser at the foreclosure sale for a sum which left a large deficiency, for which judgment was entered against Markham, who was then and for some time past had been, to plaintiff’s knowledge, wholly insolvent; that the land was, to the knowledge of plaintiff, insufficient security for the amount of the bond and mortgage, and he, being a second mortgagee with such knowledge, and in possession of the land, wrongfully, fraúdulently and with intent to cheat and defraud defendant, and with intent to reduce its security and deprive it thereof, cut or caused to be cut from the land the wood mentioned in the complaint, thereby wasting the land, and reducing defendant’s security to its damage $500.
It was held at the trial term that defendant’s cause of action did not arise out of the transaction set forth in the complaint, and was not connected with the subject of the action, and, hence, was not a proper counterclaim under § 501 of the Code.
The transaction, set forth in the complaint, was the conversion of the wood, and it cannot be said, therefore, that the counterclaim arose out of that transaction. But, nevertheless, it was connected with the subject of the action. The word “connected” may have abroad signification. The connection may be slight or intimate, remote or near. Where the line shall be drawn, it may be difficult sometimes to determine. Id.
The counterclaim must have such a relation to, and connection with the subject of the action, that it will be just and equitable that the controversy between the parties as to the matters alleged in the complaint and in the counterclaim should be settled in one action by one litigation; and that the claim of the one should be off-set against, or applied upon, the claim of the other.
In this case, it is sufficiently accurate to say that the subject of the action was the wood wrongfully taken by the defendant, and the counterclaim was for damages sustained by the defendant, in the wrongful Impairment of its security, by the severance of the same wood from the land, and *167thus diminishing the value of the land by the value of the wood. It is certainly just, in such case, that the defendant should counterclaim its damages for the severance of the wood against the plaintiff’s claim for the conversion thereof. The plaintiff was under obligation, in the form of conscience, to restore the wood to the defendant as a portion of its security for its claim against the mortgagor. It can be said with great propriety, therefore, that defendant’s claim had some connection with the subject of the action.
An action was brought, in Cass v. Higgenbotan, 100 N. Y. 248, upon a promissory note for the sum of $350. The answer alleged, by way of counterclaim, that certain diamonds had-been pledged by the defendant to the plaintiff, as collateral to the payment of the note, and that the defendant had tendered to the plaintiff the full amount due on the note with interest and costs and demanded a return of the diamonds; that the plaintiff refused to accept the tender and return the diamonds but had converted them to his own use, to the defendant’s damage in a certain sum, for which judgment was demanded. Court held that the claim of the defendant rose out of the contract between the parties, and was connected with and constituted a part of the transaction. It would have been a defense by way of recoupment before the Code, and it now comes within the provision of the present Code.
The complaint, in People v. Dennison, 84 N. Y. 272, averred, in substance, that under a contract with defendant to do certain work upon the Erie Canal, and to furnish the materials therefor, 'the defendant should have received only $74,183.40; that at various times, by false pretenses and false certificates from resident and assistant engineers the defendants obtained a large amount" of money from the State in excess of what they were legally entitled to receive under their contract, etc.
The action in this case was held to be one for a tort, and not upon contract. It was, therefore, an action in which a counterclaim founded on contract could not properly have been allowed. Id.; Smith v. Hall, 67 N. Y. 48; Pattison v. Richards, 22 Barb. 143.
The claim of the defendants was a cause of action, not arising out of the transaction set forth in the complaint as a foundation of the plaintiff’s claim, or connected with the subject of the action. The subject of the action was a fraud alleged to have been committed by the defendants upon the State. The allegation was that the defendant fraudulently obtained money from the State by means of false representations, false vouchers and collusion with State officers. The counterclaim was that the State was indebted to the defendants on contract for work and materials which had not been paid for. The circumstance that the work, in respect to which the fraudulent representations charged were alleged to have been made, was the same for which the defendants claimed that an indebtedness existed in their favor, did not bring the case within § 150 of the former Code. The subject of this action, which was the fraud, was wholly distinct from the claim set up by the defendants for money due on the contract for the work. § 150 of the former Code has not been regarded as conferring the right to set up a counterclaim, founded on contract, in an action of tort. Id. In Boreel v. Lawton, 90 N. Y. 293, an action was bought upon a *168lease under seal of rooms for an office, to recover rent accruing for the last half year of the term. The answer set up that the lessor permitted the rooms above those leased to the defendant to be used and occupied by persons who carried on a noisy business, using therein printing presses, and also weights and substances which were thrown down upon the floor immediately over the defendant’s rooms, causing great noise and disturbance, thereby interfering with the defendant’s use, occupation and possession of his rooms, and preventing him from carrying on his professional business therein, and preventing clients from consulting him, etc.; that the noise, disturbance, etc., were permitted by the plaintiff and made with her knowledge, consent and license, and that though requested, she did not prevent it, or cause it to be stopped, to the defendant’s damage in the sum of $2,000.
The facts stated in the answer, though constituting a cause of action against the plaintiff, are not available as a counterclaim in an action on the lease, for rent due, under the definition of a counterclaim in § 501 of the Code.. The right of action does not arise out of the contract or transaction set forth in the complaint, as the foundation of the plaintiff’s claim, nor is it connected with the subject of the action, nor is it a cause of action on contract. It cannot, therefore, be the subject of a counterclaim. Id.; Edgerton v. Page, 20 N. Y. 281; see also, Lounsberryu. Snyder, 31 Id. 514; Home Ins. Co. v. Sherman, 46 Id. 370; Levy v. Bend, 1 E. D. Smith, 169.
In Maders v. Lawrence, 49 Hun, 360, an action was brought upon a promissory note. A defense was interposed that the plaintiff and defendant had exchanged horses, and that the note in question was given by the defendant to the plaintiff to represent the difference in value between the horses; and that, at the time of such trade, the plaintiff warranted his horse to be perfectly sound, whereas, in fact, the horse proved to be unsound and was of little, if any, value. More than six years had elapsed from the making of the contract before the commencement of this action.
The material question was whether the statute of limitations constituted a bar to the defendant’s counterclaim, based upon such pretended warranty. The giving of the promissory note in suit constituted but part of the transaction, as the contract, which gave rise to such note, also included the warranty in question. The defendant was, therefore, at liberty to assert the breach of such warranty, with an allegation of damages in consequence thereof, as a counterclaim. Id.; Subd. 1, § 501 of Code; Farrell v. Krone, 24 W. Dig. 89; Hopkins v. Lane, 87 N. Y. 501.
The plaintiff, by commencing such action upon the note, invited any valid defense which the defendant had, arising from the transaction in which the note originated, and which legitimately assailed the consideration thereof. He cannot, under the circumstances, delay an action upon the note, until after six years from the giving thereof, and then assert the same and defeat the defendant’s claim, or defense, upon the ground that the statute of limitations barred such defense. Maders v. Lawrence, ante. The defense is merely resorted to as an attack upon the consideration of the obligation, which is the subject of the action and arising from the same transaction. It is resorted to by the defendant as a shield and not a sword. *169Tu Met: Trust. Co. v. Tonawanda, V. & C. R. R. Co. an action was brought to foreclose a mortgage made by the defendant to a trustee, to secure the payment of its bond to the amount of $600,000. The plaintiff was afterwards substituted in place of such trustee. The defendant, Farmers’ L. & T. Co., by answer, alleges, among other things, all the facts essential to the maintenance of an action to foreclose the mortgage made by the Tonawanda V. Co. to it, and demands judgment for the usual relief in such case. This answer was served upon the attorneys for the plaintiff and the other defendants.
The question was, whether the defendant, the Farmers’ L. & T. Co. could properly set up in the answer, and make available by the judgment, the matter alleged, and the demand for affirmative relief by way of foreclosure of its mortgage, and sale of the premises and property covered by it. This defendant could have brought its action in the nature of a cross bill for such relief. The right to seek it as a defendant, is dependent wholly upon the statute. The answer alleges a counterclaim within the meaning of the statute, which provides that the answer may contain a statement of new matter constituting a counterclaim, and that the counterclaim must tend ih some way to diminish or defeat the plaintiff’s recovery, and must be a cause of action against the plaintiff, or, in a proper case, against the person whom he represents, and in favor of the defendant, or of one or more defendants, between whom and the plaintiff a separate judgment may be had in the action. Id. § 500 of the Code. And such cause of action must arise out of the contract, or transaction set forth in the complaint as the foundation of the plaintiff’s claim, or connected with the subject of the action; or (2), in an action on contract, any other, "cause of action on contract, existing at the commencement of the action. § 501 of Code. And in such case, when entitled thereto, the defendant may have judgment for the affirmative relief demanded in the answer. § 504 of Code.
The subject of the plaintiff’s action, in 43 Hun, ante, was the mortgage made by the consolidated company, and the property covered by it, which embraced that in the senior mortgage of the defendant, and the purpose of the action was to foreclose the mortgage and sell the property.
The plaintiff, as a junior mortgagee, would have been a necessary party defendant, in an action to foreclose the senior mortgage. That situation was sufficient to constitute a cause of action against the plaintiff within the meaning of the statute. The affirmative relief demanded by the answer in some sense qualified or diminished the plaintiff’s recovery in view of all the allegations of the complaint and the relief demanded by it, and yet preserved all the rights to which the junior mortgagee was entitled, and afforded to the senior mortgagee only the priority to which he was entitled. And this was a legitimate result, if the matter alleged in the answer was in other respects within the requirement of a counterclaim. Id.
In Vassear v. Livingston, 13 N. Y. 248, the plaintiff was not a proper party to any action in favor of the defendant upon the claim alleged. It was not a counterclaim, because it was no cause of action against plaintiff.
The case of Frick v. White, 57 N. Y. 103, is to the same effect.
While the defendant in 43 Hun, ante, was not a necessary party defendant to the action for the foreclosure of the plaintiff’s mortgage, and the *170defendant’s cause of action might not arise out of the contractor transaction set forth in the complaint as the foundation of plaintiff’s claim, it was connected with the subject of the action. The requisite of connection of the defendant’s cause of action with the subject of plaintiff’s cause of action is not defined or restricted by the provisions of the statute. There must only be some connection. And it must have such relation to, and connection with, the subject of the action, that it will be just and equitable-that the controversy between the parties as to the matters alleged in the complaint and in the counterclaim should be settled in one action, by one litigation. Id. Carpenter v. Man. L. Ins. Co., ante.
The theory of this statute is that the right of all parties to an action, as between the plaintiff and all or any of the defendants, and as between the defendants themselves, shall be adjusted and declared by the judgment, when the relation between them and the subjects involved, are such as to permit it to be done within the practice prescribed. Id. § 1204 of the Code; Derham v. Lee, 87 N. Y. 599.
In Rafferty v. Williams, 34 Hun, 544, the controversy presented by the answer was wholly between the defendants, and had no relation to the subject of the action. The court held, in such case, that it was not within § 1204 of the Code. But prior to the present Code, the affirmative relief sought by the defendant, in 43 Hun, ante, was not available as a counterclaim. The practice did not then provide for service of pleadings by one defendant upon another, and thus permit to be brought before the court, upon the cause of action so alleged by a defendant, the other parties defendant requisite to the determination of the claim. The statute now, in view of such practice, provides that “where the judgment may determine the ultimate rights of two or more defendants as between themselves, a defendant, who requires such a determination, must demand in his answer and must, at least twenty days before the trial, serve a copy of his answer upon the attorney for each of the defendants affected by the determination,” etc., § 521 of Code.
Where this service is made, and all the parties requisite to the relief are thus brought into the controversy tendered by the defendant’s answer of the -alleged counterclaim, the said section and proceeding under it extended the application and practical effect of § 1204 of the Code. Id. Kenney v. Apgar, 93 N. Y. 539. And, where the alleged claim of the defendant embraces both a cause of action against the plaintiff and against some of the co-defendant’s, and is connected with the subject of the action, and in some degree may go to diminish the plaintiff’s recovery as measured by the relief within the demand and allegations of the complaint, the relief asked for seems to come within the meaning of the statute defining a counterclaim. This does not necessarily result from, or require the conclusion of any enlargement of the power of the court by the provisions of § 521 of the Code. But the manner of the exercise of such power is enlarged by such section, and the means are provided to parties defendant in proper case to extend the operation and effect of the provisions of § 1204 of the Code, and embrace within the term “counterclaim” some claims which, before then, the practice provided by the statute did not permit to be made available as such. Id, Albany Sav. Inst. d. Burdick, 87 N. Y. 40. *171The practice and the judgment, in 43 Him, ante, are not in contravention of any provision of the statute providing for the foreclosure of mortgages by action and the sale of the premises pursuant to judgments therein. The rights of the parties are as effectually preserved in the one, as they could have been in two distinct actions. Id.
In Ishman v. Davidson, 52 N. Y. 237, an action was brought upon two promissory notes. Defendant’s answer alleged in substance that the notes were given in part payment of a farm sold by plaintiff’s testator to defendant; that defendant was induced to purchase by means of false and fraudulent representations as to the territorial extent of the farm; that the territory falsely represented to be embraced in the farm would have enhanced its value more than $5,000, and that defendant had sustained damages to that amount. And it was held that the answer set up matter constituting a proper counterclaim in the action.
In Furber v. McCarthy, 54 Him, 435, the plaintiff, as assignee of an undertaking on arrest, brought an action to recover thereon from the obligors in the undertaking. The defendants sought to counterclaim a note. It was held that they could not counterclaim such note against the liability which had arisen upon the undertaking. The latter was not a contract. An action upon it is not an action upon contract to which a liability upon another contract can be set up as a counterclaim.
In Weston v. Turver, 49 Hun, 605, an action was brought to recover on three promissory notes of $500 each, made by the defendant to the plaintiff. The answer set up that the defendant assigned to the plaintiffs, as collateral security for her indebtedness on the notes, a certain land contract of the value of $3,000, and that the plaintiffs had wrongfully sold the-contract at private sale, without notice to her. It was held that the transaction was in violation of the defendant’s right, and that she was entitled to counterclaim the full value of the pledge. See also Stearns v. Marsh, 4 Denio, 326; Wilson v. Little, 2 N. Y. 443.
In Baker v. Platt, Sup. Ct., June, 1888, plaintiff was a lumber merchant doing business in the city of Chicago. The defendant was a broker who sold plaintiff’s property'on commission, but without authority to receive payments therefor. Defendant induced certain customers of the plaintiff to pay over to him about $2,500, due for lumber sold by plaintiff through him, which sum he retained and failed to pay over. The action was for conversion. Defendant set up as a counterclaim in the action claim for $3,000, alleged to be owing from plaintiff to him, for commission on goods sold for plaintiff.
The cause of action set up in the complaint was clearly an action in tort and not on the contract between plaintiff and defendant. The subject of the action was wholly distinct from the contract between the parties, and from any claim of the defendant for money due him from the plaintiff under that contract. People v. Dennison, ante.
To establish a counterclaim in an action in tort, under § 501 of the Code, the cause of action must arise out of the transaction set forth in the complaint as the foundation of the plaintiff’s claim, or connected with the subject of the action. The counterclaim, alleged in the answer of the defendant, in Baker v. Platt, ante, did not arise out of the transaction set forth *172in the complaint as the foundation of the plaintiff’s claim, nor was it connected with the subject matter of the action. It was not, therefore, allowed by that section.
In Meeks v. Berry, Sup. Ct., Jan., 1889, the complaint contained two causes of action. The first was for certain legal services performed by the plaintiff for the defendant between October 17, 1879, and March 17,1883, in leasing and selling certain property known as 13 West 58th St., and in -drawing certain papers in relation thereto. The second was for services as attorney for the defendant rendered upon his retainer from March 17, 1883, to the time of the commencement of this action, in defending a certain suit brought against the defendant and for his services in drawing and engrossing various instruments, and counselling and advising him. The answer alleged as a counterclaim that, at and during the time plaintiff was retained by the defendant, he was employed by the defendant as his attorney and agent to sell certain property known as No. 13 West 58th St., and was guilty of misconduct in reference to such employment.
The cause of action set up in the counterclaim did not arise out of the transactions set forth in the complaint, and is not connected with the subject of that action. Though the premises, which formed the basis of the cause of action first set up in the complaint, were the same as those mentioned in the counterclaim, the services set up therein were services in leasing and selling these premises prior to March 17, 1883. The derelictions of duty, which are' complained of in the counterclaim, occurred subsequently, in relation to the manner in which the plaintiff acted in selling these premises to an entirely different and distinct purchaser. The counterclaim, therefore, had no relation either to the first or second cause of action set up in the complaint, and, being in tort, and not on contract, could not be allowed. Id.
In Thorp v. Philbin, 15 Daly, 155, an action was brought to recover for three months’ rent of premises, and interest. The answer set up, as a counterclaim, that a sign of “to let ” was put upon the premises and allowed to remain a long time, to the great damage to the credit and business •of defendant in the sum of $5,000. The court held that this matter was not the subject of a counterclaim in this action. If the defendant had a cause of action by reason of the plaintiff’s act in affixing the sign to the premises, it did not arise out of the contract or transaction set forth in the complaint as the foundation of the plaintiff’s claim, nor was it connected with the subject of the action, nor was it a cause of action on contract.
In Birch v. Hall, 50 Hun, 602, it was alleged in the complaint that the defendant wrongfully took and collected three promissory notes, which belonged to the plaintiff, of the value of $318.; and that he refused to pay it to the plaintiff, notwithstanding she had made demands therefor. The answer contained a counterclaim for services rendered of the value of $50, and for expenses paid by defendant to the amount of $50, which services were rendered and expenses paid in collecting notes belonging to the plaintiff in paying her debts, and in preserving her property, and which were rendered and paid at her request. And it was held that such a counterclaim may be properly set up, even in an action of tort. Carpenter v. Man. L. Ins. Co., ante.
*173In Adams v. Loomis, 54 Hun, 638, the plaintiff alleged that he was the owner and in legal possession of a quantity of hay, oats and corn of the value of §57.75, which defendants then wrongfully took and converted to their own use. The defendants alleged, as a matter of offset and counterclaim, damages to the amount of §1,200 for the non-performance of plaintiff of the terms and conditions of a lease, given by defendants to plaintiff, under which the property in the complaint was produced. They demanded judgment for §1,200. And it was held that damages for breach of agreement to work farm on shares cannot be counterclaimed in an action for conversion of hay, etc., grown thereon during the term of the agreement.
It was held in Ferris v. Armstrong Mfg. Co., 57 Hun, 592, that, in an action for false imprisonment under an order of arrest, a judgment recovered against the plaintiff in the action in which he was arrested, is not a proper subject of counterclaim. See People v. Dennison, ante.
In Morris v. Emmons, 42 Hun, 659, the complaint alleged that the execution of a lease by plaintiff was accomplished by fraudulent devises, and further that he demanded possession of the demised premises, but that they were withheld from him ; and that by reason of these deceits he claimed damages. The counterclaim was one for the rent agreed to be paid by the lease mentioned. And it was held that said counterclaim was connected with the subject of the action, and, therefore, properly set up in' the answer.
In Farrell v. Krone, ante, an action was brought upon a check given by defendant to plaintiff in payment of goods bought from the latter. The answer set up, as a counterclaim, that plaintiff had made false and fraudulent representations and warranty with respect to said goods upon the said sale, and that defendant had suffered damages thereby. And it was held that the defense was one which might be pleaded as a counterclaim under the provisions of the Code, at which, if established, would be a defense either in whole or part to the claim presented on behalf of plaintiff. The said defense arose out of the transaction to which the check related.
In Grange v. Gilbert, 44 Hun, 9, the plaintiff alleged that the defendants, by wrongfully excavating the channel of Grass river, threatened and were about to divert the water from his mills to his damage, and he asked to enjoin them. The defendants set up in their answer two counterclaims. In the first they alleged that they were the owners of the right to the use of such of the waters of Grass river as, for forty years prior to 1865, flowed through a certain canal; that plaintiff’s title was subordinate to such right; that in 1865 the plaintiff’s grantor, by wrongful excavations and constructions in the bed of the river diminished the flow through defendant’s canal and increased it through his own, and that the plaintiff still maintained his grantor’s wrongful encroachment upon the defendant’s rightful share of the water, to the defendants’ injury ; and that the excavations, of which the plaintiff complained, were proper to restore to each his proper share of the water. In the second counterclaim, they alleged that the plaintiff wrongfully stored, and threatened to continue to store, logs in the bed of the river, and, in seasons of low water, these logs obstructed the natural flow of the water into defendants’ canal, to defendants’ injury.
*174The subject of the action was not the injury threatened to the rocks or land in the bed of the stream, but the injury threatened to plaintiff’s alleged water rights. The defendants’ first counterclaim is, in substance, that the water rights claimed by the plaintiff do not, to the extent claimed, belong to him, hut are in part the rights of the defendants, and which the plaintiff, by wrongfully continuing the original diversion of his grantor, now keeps and withholds from the defendants, to their injury. They demand that the diversion shall cease and their proper rights be restored. If the defendants establish their position, they may altogether defeat the plaintiff’s recovery, for it may be that the only way to grant the defendants restoration, will he to permit the excavation in whole or in part, of which the plaintiff complains. The counterclaim is, therefore, so connected with the subject of the action that the success of the one inevitably defeats or diminishes the recovery upon the other. But the claim set up in the second counterclaim, in Grange v. Gilbert, ante ; was not connected with the subject of the action. The subject of the action was the injury threatened to plaintiff’s alleged water rights by defendants’ permanent excavations. The subject was not touched by an allegation that the plaintiff, by storing his logs in the millpond or stream, impaired the defendants’ water rights. The defendants’ right to recover could not properly defeat or diminish the recovery by the plaintiff.
In Moser v. Cochrane, 13 Daly, 159, an action was brought to recover $1,000 paid by the plaintiff to the defendant on a contract for the purchase of real estate. The defendant in his answer set up a counterclaim for specific performance of the contract by plaintiff. And it was held that such counterclaim was in conformity with the requirements of § 501 of the Code. The plaintiff sought to recover a certain sum of money which he paid to the defendant upon a contract for the conveyance of real estate. The answer set up matters tending to show that the plaintiff ought not to recover, but ought to be compelled to perform his contract. It, therefore, tended to defeat the plaintiff’s recovery. The counterclaim in this case is a cause of action arising out of the contract or transaction set forth in the complaint as the foundation of the plaintiff’s claim, or connected with the subject of the action. It has such a relation to the subject matter of the action, that it will he just and equitable that both should he settled by one litigation. Id.; Carpenter v. Man. L. Ins. Co., ante.
Tn Edgerton v. Page, ante, the complaint was for the payment of rent upon a lease of the demised premises. The defendant’s demands arise from the wrongful acts of the plaintiff in permitting water to leak and run into the premises, and in causing or permitting it to he thrown upon the premises and property of the defendant.
These acts are entirely independent of the contract of leasing upon which the action was brought. The demands are not connected with the subject of the action ; that is, the rent agreed to be paid for the use of the premises.
They are for a series of injuries to his property deposited upon the premises, and for impairing the value of the possession. In an action for rent, injuries from trespasses committed by the lessor upon the demised premises cannot he interposed as a counterclaim. The acts of the plaintiff, in Edgerton v. Page, ante, were of a similar nature. They were either acts *175of trespass of negligence, from which the injuries to the defendant accrued. Unless the acts or the defendant amounted to a breach of the contract of letting they were not connected with the subject of the action. None of them were done under any claim of right whatever. They did not therefore, amount to a breach of the contract created by the lease, and the injuries sustained by the defendant did not, therefore, constitute a counterclaim connected with the subject of the action, nor arising out of the contract set forth in the complaint.
In Bradhurst v. Townsend, 11 Hun, 104, an action was brought to set aside the assignment and to obtain a reassignment of two bonds and mortgages, assigned by Nicoll, acting under a power of attorney from the, plaintiff, to himself and the other two defendants, as executors of the estate of Isaac Townsend, deceased, and for the recovery of the moneys which had in the meanwhile been collected upon them. The answer, by way of counterclaims, set forth that Nicoll and two other persons empowered to act with him as attorneys of the plaintiff, had in their possession three other bonds and mortgages, with authority to assign them, and that they did, for "a valuable consideration, assign them to the defendants as such executors. It was further alleged that the plaintiff had afterwards acquired possession of them and refused to deliver them to the defendant. Similar allegations were made concerning two other bonds and mortgages which were alleged to have been afterwards assigned to the plaintiff, who refused to assign or deliver them to the defendants. The assignment sought to be set aside was made in November, 1870; the others in January or October, 1873. It was held that the causes of action set forth as counterclaim did not arise out of the contract or transaction set forth in the complaint, nor were connected with the subject matter thereof. The fact that they resulted from the existence of the same power over the plaintiff’s property did not in any way unite or identify them. They were still just as separate and distinct as they would have been if a special power had been created for the disposition of each of them. The object of one claim is to vacate and set aside the transaction out of which it arose, and of the other to secure the specific performance of the act necessary to complete assignments shoym to have been made. Id.
In Clapp v. Wright, 21 Hun, 240, plaintiff sought to recover for services rendered by him to defendant. The latter set up as a counterclaim, that the plaintiff was a trustee of a manfacturing corporation, and had, by reason of a failure to file the yearly report of the company, made himself liable for the payment of its debts, and that the defendant held debts of the company, at the time of the default, which he would prove against plaintiff’s claim.
The counterclaim was not based upon a contract, existing at the time of the commencement of the action, as required by § 501 of the Code. The claim against plaintiff, as trustee, is not a claim upon contract. The liability is a penalty imposed upon plaintiff for neglect of duty. Id.; Merchants’ Bank v. Bliss, 35 N. Y. 412; Chambers v. Lewis, 28 Id. 454.
In Denniston v. Trimmer, 27 Him, 393, an action was brought to recover a penalty of §50 for selling liquor without a license, contrary to the excise laws of the state. The answer set up a counterclaim against the plaintiff *176as overseer of the poor, for money loaned and advanced by the defendant to plaintiff. It was held that there is no statute which authorizes the overseers of poor to borrow money, and to off-set or counterclaim therefor in a penal action; and that the attempt of the defendant to set up a claim for money loaned to plaintiff as overseer of the poor, against a demand for a penalty for violation of the excise law, is without precedent and sanction of any statute.
In Barnes v. Gilmore, 6 N. Y. C. P. 286, the plaintiff, as part of the relief demanded, asked for an accounting for the rents and profits of certain premises during a certain period. The counterclaim was for certain rents due from plaintiff to defendant for a part of the same premises during a portion of the same period. It was held that the counterclaim conformed to the requirements of the statute. The counterclaim permitted by § 500 of the Code must tend in some way to diminish or defeat the plaintiff’s recovery, and, except in an action on contract, must be a cause of action arising out of the contract or transactions set forth in the complaint as the foundation of plaintiff’s claim, or connected with the subject of the action. In this case, it tended to diminish the plaintiff’s recovery. It was connected with the subject of the action, which is the real estate in question, and arose out of the foundation of the plaintiff’s claim, to wit: the execution of said deed and contract. It contained, therefore, all the elements of a good cause of action for rent, use and occupation, viz.: ownership by the landlord, actual occupation by the tenant, and an agreement by latter to pay at a specified rate for a specified time.
In Bell v. Lesbini, 4 N. Y. C. P. 367, an action was brought to recover a balance for board and lodging furnished by the plaintiff to the defendant. The defendant set up a counterclaim for damages for the conversion of certain personal property belonging to him, alleging that the plaintiff ejected him from the room in her house occupied by him, and took therefrom the said personal property, and converted it to her own use.
The subject matter of the counterclaim was the tortious act of the plaintiff in wrongfully taking and converting to her own use the property of the defendant. A clear case of tort, not arising out of the transaction mentioned in the complaint, has never been allowed to stand in opposition to a recovery upon a contract. Id. Piser v. Stearns, 1 Hilt. 86; Chambers v. Lewis, ante. There are some cases in which the doctrine might be said to be allowed to prevail to the extent of permitting a party to waive the tort and recover on an implied contract. But an examination of those cases will disclose the fact that there existed a conventional relation between the parties; e. g., as an agent who collects for his principal and refuses to pay over the money. Coit v. Stewart, 12 Abb. N. S. 216. But usually, in an action on the contract, a cause of action, founded in tort and not arising out of the transaction mentioned in the complaint, cannot be set up as a counterclaim.
In Glenn & H. Mfg, Co. v. Hall, 61 N. Y. 226, an action was brought to restrain the defendant from using an alleged trademark, “ Humber 10,” on the ground that it was a part of the plaintiff’s trademark. The defendant alleged that it was part of his own trademark, and set up that the plaintiff had fraudulently used the same for the purpose of unfairly securing the de-. *177fendant’s customers, and asked, by way of counterclaim, that the plaintiff might be enjoined from using the words in the course of its business to the defendant’s damage.
The subject of an action is either property (as illustrated by a real action), or a violated right. In the present instance the subject of the plaintiff’s action was the expression “ Number 10,” of which it claimed ownership as a designation of its business. The defendant’s counterclaim was a cause of action against the plaintiff growing out of its infringement of his right to the same expression, which he asserted belongs to himself. It was closely united to the matter in controversy; it was in fact, inseparable from it. In the language of the Code, it was “connected” with it. The injunction was a mere remedy, purely incidental to the subject of the action, and not the subject itself. The plaintiff in substance, said to the defendant: “ Number 10,” is my property, and you must not use it. The defendant responded, in his counterclaim: It is mine; you are injuring me by your unlawful use of it. Is not this claim connected with the subject of the plaintiff’s action ? The policy of the Code requires a liberal construction of this section, to the end that controversies between the same parties, on the same subject matter may be adjusted in a single action. Id. See Ashley v. Marshall, 29 N. Y. 494.
In Heidelbach v. Kilpatrick, 3 N. Y. C. P. 209, an action was brought for damages resulting from false representations, by which plaintiff was induced to purchase certain real property. The answer sets up the counterclaim that plaintiff is justly indebted to defendants for the sum of $550, moneys paid out and expended by defendant at the request and for the benefit of plaintiff in reference to the building, numbers 4S and 50 East 58th Street in the" city of New York, in improvements in the plumbing thereof contracted for in the contract of purchase set forth in the complaint, and which is the subject of the action herein.
The action was not founded upon the contract, nor the breach thereof; but the subject of the action was the injury sustained through the defendant’s false representations. With that matter, the alleged counterclaim had no such connection as to entitle it to be set up, to defeat or diminish the plaintiff’s claim for damages. Id. Lehman v. Griswold, 40 N. Y. 100; People v. Dennison, ante ; Berrian v. Mayor, etc., 15 Abb. N. S. 297.
In Harlock v. LeBaron, 1 N. Y. C. P. 168, an action was brought to recover the value of professional services rendered the defendant in four certain actions by the plaintiff’s assignor, an attorney and counsellor-at-Iaw. The answer interposed, as a counterclaim, that the plaintiff’s assignor had, within the period of his employment, and in a certain action, not among those of which the plaintiff based his claim, given the defendant “foolish, illegal and bad advice,” by reason of which the defendant had suffered damages and loss "to an amount exceeding the plaintiff’s claim, and demanded affirmative judgment. And it was held that, though the plaintiff did not count upon the services rendered in reference to the action, in which such bad, illegal and foolish advice was given, the contract and transaction between an attorney and client is the employment, and both the plaintiff’s claim for his assignor’s services, and the defendant’s claim for out of such employment. *178The position that a State hy coming into court as a suitor, abandons its sovereignty and subjects itself to any affirmative judgment, which the court may render against it upon a set-off or counterclaim, cannot be maintained. People v. Dennison, ante. It is opposed to all the authorities, and the principle upon which they are founded. The dicta of learned judges, which have been cited in its support, though maintaining the right of set-off, do not necessarily go to the extent of asserting that an affirmative judgment may be rendered against the government for any balance found due from it. Id. While the government may, through its courts, enforce its claims against its subjects, this right is not reciprocal. It cannot be sued except by its own express permission. This is a universal principle often recognized in the courts of the United States. Id. It is now well settled that such counterclaim is available only to the extent necessary to defeat the claim of the government, and that no judgment can be recovered against the latter for the excess, in case there should be any. Id.
In People v. Corner, 59 Hun, 299, the plaintiffs, between July 9, 1888, and January 21, 1889, sold and delivered to the defendant at the Hew York State Reformatory at Elmira, brushes and brush material at and for the price, and of the value of $11,627.97. The defendant’s answer stated that the plaintiff had, for a good and valuable consideration, agreed to make, manufacture and produce for the defendant, and deliver to him a large quantity of brushes of various kinds and descriptions. It then set'up nonperformance of contract and damage in at least $10,000.
Even though such new matter constituted a cause of action in favor of the defendant, and he was entitled, equitably and justly, to recover, by reason of such new matter, damages from the State, no such recovery or allowance can be had in this action. If the plaintiff had not commenced this action, it is well settled, by an unbroken line of authorities, that the defendant could not have brought and maintained an action against the State. In seeking redress for the injuries sustained by him, if any, by reason of a breach of the terms of the contract referred to in his answer, his remedy must be sought in a court of claims, established by the State for ascertainment of damages in such and other cases. People v. Dennison, 69 How. 157 ; aff’d 84 N. Y. 272 ; Reeside v. Walker, 11 How. U. S. 290; O’Hara v. State, 112 H. Y. 154; Rexford v. State, 105 Id. 231: Danolds v. State, 89 Id. 36; United States v. Giles, 9 Cranch, 228.