McCOY, J.
Plaintiff, who is appellant in this court, brought this action to recover from defendant, the respondent, a balance *178of $1,728.55 claimed to be due on six promissory notes set out in the complaint. To this complaint the defendant made answer admitting the execution and delivery of said notes, and as a counterclaim alleged that on or about April, 1909, plaintiff and defendant entered into a certain contract for the sale of a threshing rig, consisting, among other things, of a steam engine and separator, purchased from plaintiff by defendant for the agreed contract price of $4,412.50, and that the said notes mentioned in the complaint were given in consideration of a part of said purchase price under said contract; that under and by the terms of said contract of sale, ahd as a part of the same transaction, plaintiff agreed, upon notice and at defendant’s request, to remedy any defects in 'said engine and to put it in good order, and that in and by the terms of said contract defendant agreed, upon request of plaintiff, to render assistance to plaintiff while repairing said engine; that pursuant to the said contract and about July, 1909, at the request of defend'ant, plaintiff sent one of its servants and agents to the farm of defendant to repair the said steam engine; that plaintiff’s said servant and agent entered upon the work of repairing said engine, and while so acting, and as such servant and agent, and while so engaged in said work and in the performance of his duties within the scope of his authority, requested defendant’s minor son, Andrew Klein, to assist him in the prosecution of said work; that while said son was so engaged in assisting the said servant and' agent of plaintiff the said servant and agent of plaintiff so carelessly and negligently started up and operated said engine that it caught the foot and leg of said minor son under one of the wheels of said engine, and so drew said foot and leg under the wheel of said engine that the same was crushed, and the bones and flesh so mangled and mashed that it was necessary to amputate, and the defendant caused to be amputated the leg of said minor just below the knee; -that at all the times herein set forth the said Andrew Klein was the minor son of defendant, and as such was under defendant’s guardianship and in his custody, control, and employment; and plaintiff’s said agent and servant requested said minor son to assist him in said work as the ward and employe of defendant, and such assistance was rendered to plain*179tiff’s said servant and agent under and in pursuance of the contract between plaintiff and defendant as hereinbefore set forth: that on account of said injury defendant was compelled to and did expend $550 for nursing and. in medical attendance upon and medicine for said minor son, and said minor son has been rendered permanently lame and unable to perform work and labor, and defendant thereby deprived of the se'rvices of said minor son until he shall become of age, to his damage in the sum of $2,500. Wherefore defendant demands judgment against the plaintiff in the sum of $2,500, and that said amount, sufficient to cancel the amount due on said notes and the obligation set forth in plaintiff’s complaint, be set off against the same, and that defendant have judgment for the balance thereof, together with costs. To this counterclaim plaintiff interposed a demurrer upon the grounds: (1) That said counterclaim is not founded upon the contract set forth in plaintiff’s complaint, as a foundation of plaintiff’s claim, or connected with the subject of the action; (2) nor does the counterclaim state a cause of action arising on contract, but is a separate and distinct cause of action founded on tort. The court overruled said demurrer, to which ruling the plaintiff excepted and now urges such ruling as error.
The principal contention of appellant is that the counterclaim is not connected in any manner with the contract sued upon, namely the notes; that the notes sued upon form the basis of the cause of action; and that the counterclaim must be connected with the contract sued on, and form a part of the transaction of the giving of the notes only. We are of the opinion that this contention is not tenable. The consideration of this question involves the construction of subdivision I, § 127, Code Civ. Pr. A like provision is found in the Codes of many other states. In the case of Story v. Story & Isham Commercial Co., 100 Cal. 30, 34 Pac. 671, the court held that the ‘'transaction” comprehended within the meaning of this section of the Code is not limited to the facts set forth in the complaint, but includes the entire series of acts ana mutual conduct of the parties in the business or proceeding between them which formed the basis of the agreement, and if *180plaintiff omits or fails to set forth in his complaint the entire transaction out of which the claim arose defendant may supplement this omission by setting forth in his answer the omitted facts, so that the entire transaction may be before the court. The plaintiff is not at liberty to select an isolated act or fact, which is only one of a series of acts or steps in the entire transaction, and insist on a judgment on that fact alone, if the fact is so connected with others that it forms only a portion of the transaction. See, also, 34 Cyc. 686 and 687. In the case at bar, the notes set out in the complaint constitute but a component part or portion of the entire transaction of the sale of the threshing machinery by plaintiff to defendant. The contract of sale with all its mutual agreements and provisions, the acts of all the parties and their agents performed under and by virtue thereof in carrying out and performing the mutual provisions thereof, the repair of the engine, the assistance to be furnished in such repair on the part of defendant, are all parts of one and the same transaction, just as much as the giving or the payment or nonpayment of the notes sued upon. The question then arises, Was the alleged negligent injury to the defendant’s son so connected with the transaction or subject-matter of the' action as to constitute a proper counterclaim ?
The question, based largely on the New York decisions, seems to be well stated in 34 Cyc. 687; “It is difficult to determine or to lay down a rule for determining when a cause of action set forth in the counterclaim is so connected with plaintiff’s cause as to be allowable under the section allowing a counterclaim connected with the subject of the action, for the word ‘connected’ may have a broad signification; the connection may be slight or intimate, remote or near; the best rule for determining the required connection being that 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 and by one litigation, and that the claim of one should be offset against or applied upon the claim of *181the other. But some connection between the claims themselves, independent of their being held by the parties to the action, is required, which may be shown from their originating in tide same contract, or transaction, or both, involving some right or interest in the subject of the action. The term ‘connected with the subject of the action’ should, however, be construed liberally with a view of settling disputes in ope action as far as possible.” This same rule is quoted with approval and followed by this court in McHard v. Williams, 8 S. D. 381, 66 N. W. 930, 59 Am. St. Rep. 766, and again in Northwestern Port Huron Co. v. Iverson, 22 S. D. 314, 117 N. W. 372, 133 Am. St. Rep. 920. Keeping in view the principles that one of the most important purposes of the adoption of the code system of pleading was to avoid as far as possible a multiplicity of suits, and to enable parties to determine their differences in one action, and also that if 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 suit and by one litigation, it would seem that the counterclaim of defendant in this action is proper under the provisions of section 127, Code Civ. Pr., although sounding in tort. This counterclaim is for damages alleged to have been caused by the negligent acts of the servant and agent of plaintiff while repairing- the engine purchased by defendant from plaintiff. The said servant and agent was performing such services for plaintiff under and by virtue of the contract of sale out of which the nates sued upon arose; and the 'son of the defendant was also performing services for plaintiff in assisting in the repair of said engine under and by virtue of the same contract. Both were performing services and assuming to act in relation to the carrying out of the provisions and business created by the terms of the contract, as a part of the mutual obligations and conduct required thereunder between plaintiff and defendant. The alleged damages having occurred under such circumstances and in such connection sufficiently connects the counterclaim with the subject-matter of the complaint, so as to render it equitable and just that both matters should be determined in one suit and by one litigation. The matters set out in the complaint and the matters set out in the coun*182terclaim are intimately and closely connected, and have their origin in the same transaction. The said acts of said servant and agent of plaintiff, which constitute the negligence complained of in the counterclaim, were performed under and by virtue of the contract of sale which furnished the basis for the consideration of the notes sued upon.
The order appealed from is affirmed, and the cause remanded for further procedure.
SMITH, P. J., dissents.