This action was brought to restrain the defendant from interfering with the trade and business established by the plaintiffs in Great Britain and the continent of Europe and elsewhere, under and in pursuance of an agreement dated February, 1894, a copy of which was annexed to the complaint. That agreement was a substitute for an agreement made between the same parties in the year 1891, which was also annexed to the complaint, but plaintiffs claim no right and admit no liability thereunder. The agreement of 1894 contained a provision that, in the event of its being terminated as therein provided, all contracts made and other ■undertakings entered into shall be carried out by the parties. The Answer admits the making of the agreement of 1894 annexed to the complaint; denies breaches of that agreement by the defendant; alleges certain breaches of it by the plaintiffs; alleges that thé plaintiffs had sold and transferred unto one James Lawlor all their right, *811title, and interest in and to the claims and causes of action arising out of the alleged breaches by the defendant of the contract set forth in the complaint; and, as a counterclaim to the causes of action alleged in the amended complaint, alleges that the plaintiffs failed to carry out the terms and conditions of the contract of 1894 annexed to the complaint, as modified, and, by reason of the failure on the part of the plaintiffs to comply with the obligations of this -contract, these plaintiffs became liable to all the terms and conditions •of the contract (Exhibit E, which was the contract executed in 1891); that the defendant had performed all the obligations and conditions precedent of the contract of 1891, annexed to the amended complaint, on its part to be performed, and was and is at all times willing and ready to carry out the conditions thereof, and has frequently offered so to do; that the plaintiffs had failed to perform the obligations and conditions of said contract on their part to be performed, and have refused and neglected to carry out the conditions thereof; and that in consequence thereof the defendant has sustained damage in the sum of $60,000, for which amount the defendant demands judgment against the plaintiffs. The plaintiffs replied to this counterclaim, and the action was referred, by consent, to a referee to hear and determine. Upon the case coming on for trial, the plaintiffs’ counsel moved to dismiss the counterclaim alleged in the answer .arising under the contract of 1891, upon the ground that this is not .•an action upon contract; that the relief sought by the complaint is .an injunction, and that this alleged counterclaim arises under a contract entered into between two of the plaintiffs and the Magnolia Antifriction Metal Company, a party other than defendant; and also on the ground that the contract of 1891 is not alleged to be the contract of the plaintiffs, nor is it the contract of the defendant. This motion was denied, and the plaintiffs excepted. It was then admitted that, pursuant to prior stipulations between the parties, the issues to be tried in this action were solely upon the counterclaim alleged in the answer and controverted by the reply, and that the defendant would offer no evidence in support of any of the counterclaims pleaded, except the counterclaim arising under the contract of 1891. It was further stipulated that any evidence taken in the action brought by James Lawlor against this same defendant, relative to the issues in this action, “may be received in evidence without repetition with the same effect, and subject to the same objections, as if taken in this case.” The defendant then put in evidence the testimony taken at the trial of Lawlor against this defendant. Further evidence appears to have been offered by both the plaintiffs and the defendant, when the question was submitted to the referee, who found in favor of the defendant against the plaintiffs, and awarded the defendant as damages the sum of $13,425.04, for which judgment was entered. The report of the referee shows that the cause of action for an injunction alleged in the complaint had been abandoned before the trial, and the trial narrowed to the defendant’s counterclaim for damages for a breach of the contract between the parties dated March 25, 1891; that the defendant was not entitled to a counterclaim for damages under the contract of 1894, because it elected to *812revive the contract of 1891, and the defendant's damages are to be determined therefrom; and that the defendant sustained damage by reason of a violation of the contract of 1891, leaving the net damage due to the defendant the sum of $10,584.79, with interest from January 29, 1896.
The first question presented is whether this cause of action set up as a counterclaim to the cause of action alleged in the amended complaint can be enforced in this action against the plaintiffs. The action was, as before stated, an equitable action to enjoin the defendant from interfering with the trade and business established by the plaintiffs under and in pursuance of the contract of 1894, and from doing any act which would interfere with the plaintiffs in the control, ownership, and enjoyment of the said business; and that the plaintiffs be adjudged to have fully performed such agreement of 1894 in all things on their part, except' so far as they were prevented by the acts of the defendant; and that the defendant be required to transfer and set over to the plaintiffs the said business, good will, and appurtenances, including trade-marks, secrets, formulas, or secret processes for the manufacture of metal, as provided by the terms of the said agreement of 1894. The cause of action here sued on was purely an equitable one. It was based upon the performance of the contract of 1894 by the plaintiffs, but asked for no damages against the defendant; the right to this relief depending upon the existence of the contract of 1894, and the fact that the plaintiffs had performed that contract. The basis of the alleged counterclaim was a violation by the plaintiffs of the terms of a contract made in 1891, to which this defendant was not a contracting party, and which was made by two of the three plaintiffs only. The right to enforce this agreement had been acquired by the defendant by assignment from the corporation in whose favor it was made. It seems to me that the defendant could not enforce this counterclaim in this action. By section 501 of the Code of Civil Procedure, it is provided that “the counterclaim, specified in the last section, must tend, in some way, to diminish or defeat the plaintiff’s recovery, and must be one of the following causes of action against the plaintiff * * * and in favor of the defendant: * * * (1) 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. (2) In an action on contract, any other cause of action on contract, existing at the commencement of the action.” This alleged counterclaim does not come within either of these subdivisions. It is not “a cause of action arising out of the contract set forth in the complaint as the foundation of the plaintiff’s claim,” as the contract set forth in the complaint is the contract of 1894, and no claim for relief is based upon the contract of 1891. If plaintiffs’ allegations are true, the contract upon which the counterclaim is based was superseded by the contract of 1894. Nor was it connected with the subject of the action. This phrase, “subject of the action,” is quite indefinite, and somewhat difficult of exact definition. It has been defined, however, as “connected with the facts constituting the plaintiff’s cause of action.” Rothschild v. Whitman, 132 N. Y. 472, 30 *813N. E. 858. Now, the facts constituting the plaintiffs’ cause of action were the rights and property acquired under the contract of 1894. So far as the defendant’s allegation was that this contract was not in force because of breaches by the plaintiffs, it might have been a good defense to this action, but the existence of the contract of 1891 had no relation to the subject-matter of the action brought to enforce the plaintiffs’ rights of property, and whether the contract of 1891 was or was not violated had no relation to the right of the plaintiffs to the judgment asked for.
Nor do we think that this action was an action on contract, within the second subdivision of this section. It is true that the right of the plaintiffs to relief would depend upon the contract of 1894; but it was an action in equity, asking for the equitable interposition of the court to secure to the plaintiffs the possession of certain property or properly rights which they had acquired, and of which it was alleged the defendant sought to deprive them. I think this case is analogous to that of Dinan v. Coneys, 143 N. Y. 546, 38 N. E. 715, where the action was in ejectment to recover property devised to the plaintiff in the will of his father, and the defendant attempted to set up a counterclaim to recover a legacy which the defendant alleged was a charge upon the land left by the will. The court held that this legacy was.not a counterclaim which could be enforced in the action,—First, because it did not tend to diminish or defeat the plaintiff’s recovery; and, second, because it was not a cause of action accruing 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. Here the rights of both the plaintiff and the defendant accrued under the same instrument. By it the plaintiff was given the land, and the defendant was given a legacy which was a charge upon the land, and the court held that, in an action to recover possession of the land, a demand for the payment of the legacy could not be enforced as a counterclaim. And so in this case: The plaintiffs’ cause of action being to recover or retain property to which they were entitled, namely, the rights and business established by the plaintiffs, a cause of action for a breach of contract, other than that under which the plaintiffs claim, could not .be enforced as a counterclaim. Nor do I think that this counterclaim can be said to tend in any way to diminish or defeat the plaintiffs’ recovery. If the plaintiffs were entitled to an injunction, the recovery by the defendant of a money judgment against the plaintiffs would not in any way tend to diminish or defeat the plaintiffs’ right to an injunction. Dinan v. Coneys, supra; Lipman v. Iron Works, 128 N. Y. 63, 27 N. E. 975. This cause of action, alleged as a counterclaim, not being one allowed by the Code, and not available as a counterclaim, the plaintiffs did not, by replying to the answer, waive their right to take the objection on the trial, nor were they compelled to demur in order to raise the question. Dinan v. Coneys, 143 N. Y. 546, 38 N. E. 715.
I think, therefore, the referee should have dismissed this counterclaim, and for that reason the judgment should be reversed; and, as the defendant cannot recover against the- plaintiffs in this action *814upon this counterclaim, it is not necessary to order a new trial, but the judgment could be modified by striking out the affirmative recovery, and simply dismissing the action, under the circumstances-without costs in the court below, but with costs to the appellants-upon this appeal. All concur.