Mr. Justice Woods
delivered the opinion of the court. After stating the facts as above reported, he continued:
It is not disputed that if the transactions out of which this suit arose were of the character described in the counter-claim and testimony of the defendant, they fell under the ban of section 130 of chapter 38 of the Revised Statutes of Illinois of 1885, page 405, which was in force when the transactions took place. That section, so far as applicable to this case, was as follows: " "Whoever contracts to, have or give to himself or another the option to sell or buy at a future time any grain Or other commodity, . . . shall be fined not less than $10 nor more than $1000, or confined in the county jail not exceeding one year, or both, and all contracts made in violation of this section shall be (Considered gambling contracts, and shall be void."
The errors assigned by the plaintiffs relate exclusively to the charge of the court and the rendering of judgment in accordance with the verdict of the jury.
The first complaint made against the charge is that the court withdrew from the jury the question of fact whether the plaintiff's had or had not complied with the rules of the Board .of Trade in reference to the substitution of other contracts for those made by them for the defendant, and which they subsequently offset and settled, and charged the jury that certain substitutions of contracts alleged by the plaintiffs to have been made, by them were not as matter of law made in accordance with 'the rales of the Board of Trade.
"We think there was no error in the charge of the court complained of. • The rule of the Board of Trade upon this subject (sec. 6, rule 26) provides that where purchases or sales shall have been made by.a commission merchant, a member of the board, .by order or for account of another person, and it shall subsequently appear that such " trades " may be offset and settled by other "trades" made by the same commission merchant, he shall be " authorized to make such offset and settlement and to substitute some person or persons for the one from or to whom he may have purchased or sold the property originally."
The meaning of this rule is plain,.namely, that when a com- • mission merchant having made a contract for his principal with a third person, assumes to offset or cancel the contract, he shall substitute therefor, another equivalent contract with some other person who shall be bound to his principal, for its performance.
It is well settled, as a general rule, that a written contract made by a factor in his own name for the purchase or sale of goods for his principal will bind the principal, and he may sue •and be sued thereon exactly as-if he were named in it, for it is treated as the contract of the principal as well as of the agent. Higgins v. Senior, 8 M. & W. 834; Huntington v. Knox, 7 Cush. 371; Taintor v. Prendergast, 3 Hill, 72; Ford v. Williams, 21 How. 287.
The rule of the Board of Trade provided, as has been seen, that where the commission merchant has substituted one contract for another he shall guarantee to his principal the performance of the substituted contract.
It follows that upon the original.contracts made by the plaintiffs for the defendant, the latter, upon their breach, had a right of action against the parties with whom the contracts were made. The purpose of the rule was, therefore, plain, namely, to provide that when contracts were cancelled and others substituted, the commission merchant, as well as 'the party bound in the substituted contract to sell or buy, should be .liable to the other party for its performance. The rule, therefore, does not authorize the commission merchant to release the party to the original contract unless he provides some one else to, assume the obligation, or, as the rule states it, "substitute some person or persons for the one from or to whom he may have purchased or sold the property originally."'
The only evidence in'the case in regard to the cancellation of the original contracts made by the plaintiffs for the defendant and the substitution of other contracts was the testimony of the plaintiffs themselves. They do not contradict each other, .and' there is no contradiction or impeachment of their testimony on this point in the record. These witnesses make it clear that, after the contracts made by them for the defendant had been offset against others, and thereby cancelled, no other contracts were substituted in their place which the defendant could have enforced. In fact there was no substitution. No contracts were designated to take the place of those cancelled. All that the plaintiffs say on this point is, that it was their purpose to apply the first produce delivered in August' on contracts of sale, first to the oldest contract of purchase, and it was uncertain on what contract the first. delivery would be made until the 'delivery actually took pláce. If there was any substitution of other contracts for the cancelled ones it was only, in the mental operations of the plaintiffs, to which no outward expression whatever was given.' The plaintiffs admit in their evidence that after the original contracts made for the defend- • ant were offset and released they alone were bound to the defendant, and that there were no other persons against whom the'-defendant could have maintained an action. It is plain, therefore, that upon their own showing the plaintiffs did not make the substitution required by sec. 6 of rule 26 of the Board of Trade..
The facts of the case being shown and not disputed, the question whether there had been a valid substitution of contracts under the rule referred to was a question of law. It depended on the construction of the rule, which it was the duty of the court to interpret. Levy v. Gadsby, 3 Cranch, 180; Walker v. Bank of Washinqton, 3 How. 62; Goddard v. Foster. 17 Wall. 123.
When, therefore, the Circuit Court said to the jury, that, •assuming that the plaintiffs themselves have told the truth in 'this case, there has been no valid substitution of other contracts for those that were cancelled it was merely applying the rule of the Board of Trade as it construed it to the plaintiffs' own-version of the facts, and, in so doing, discharged its own duty without invading the province of the jury. It is quite clear, also, from what has been said, that the construction put on the •rule by the Circuit Court was correct. We do not see how the rule could have been differently construed. The case, as shown , by the testimony, was this: The plaintiffs had been employed ' by the defendant as his agents to make contracts in his behalf for the purchase of pork and lard. They made contracts under this authority and almost immediately cancelled them, and substituted- no other contracts which the defendant could have enforced. There is nothing, in the record to show that the plaintiffs were liable to the defendant upon the original contracts made by them for the latter, and there were no substituted contracts on which either the plaintiffs or other persons were liable. The .defendant, therefore, on August 1, 1883, had no contract on which he could have demanded the delivery of a pound of pork or lard, or have sustained an action against any one for failure to deliver. The money which the plaintiffs seek to recover in this suit .was not, therefore, paid out for the .use of the defendant, and an action therefor cannot be maintained against him.
The court would, therefore, have been justified in charging the jury, that, upon the plaintiffs' own testimony, they were' not entitled to' a verdict against the defendant upon the cause of action set out in their petition. Pleasants v. Fant, 22 Wall. 116; Griggs v. Houston, 104 U. S. 553; Randall v. Baltimore & Ohio Railroad Co., 109 U. S. 478. We are of-opinion, therefore, that the charge of the Circuit Court, so far as it related to the right of the plaintiffs to recover, was not open to any of the objections urged against it by the plaintiffs.
The next objection made to the charge has reference to that instruction in which the court said: " If you find the original contract to have been valid, and that the defendant is excused ,oi absolved from liability because of the attempted substitutions,, which the court'instructs you were not made in accordance, with said rule, then, and in that case, the defendant will be entitled to recover upon the cross-action against the plaintiffs for all the money which he advanced in pursuance of these con-' tracts." This part of the charge was specifically pointed put by an exception taken by the plaintiffs, to the effect that it allows the defendant to recover, notwithstanding his confession 'of record that.the transactions in which he was engaged with ,the plaintiffs were gambling transactions, and allows him to recover what he admits were advances made for the purpose of carrying on the business of gambling. We think, therefore,' that the record fairly presents the question whether this' instruction was right. The Ohio Code of Civil Procedure requires that a cause of action set up as a counter-claim in the answer of the defendant " must be one . . arising out. of the-contract or transaction set forth in the petition as the foundation of the plaintiff's claim, or connected with the subject of the action." Sec. 94. The counter-claim pleaded by the defendant was within the terms of this section.
A counter-claim under the Ohio Code is regarded as .a cross-action. When it has been set up in an answer the plaintiff, will not be allowed to dismiss his suit .without the defendant's consent, Wiswell v. First Congregational Church, 14 Ohio St. 31; and it must state facts recognized by courts of law or equity as constituting a cause of action, Hill v. Butler, 6 Ohio St. 207. If a plaintiff dismiss his action against the defendant, or fail to appear, that will not prevent the defendant from prosecuting the- counter-claim set up in the suit to final judgment againt the plaintiff. Code of Procedure, § 373. Rev. S-tat. 1880, § 5315.
The court may at -any time before the final submission of the cause allow a counter-claim set up in the answer, to be withdrawn, and on motion of either party an action on the same shall be docketed and proceeded in as in like cases after process served. Code of Procedure, § 119.
The defendant's counterclaim is, therefore, to be tested by the same rule as if it had been the basis of an independent action, and the question is whether under any circumstances the defendant should have been allowed upon the pleadings and evidence to recover a judgment thereon. The instruction of the court now under review directed the jury, if they found the original contract to have been valid, but the defendant not hable thereon, because the substitution was not made as required by the rules of the Board of Trade, that the defendant was entitled to recover the money advanced by him to the plaintiffs. The verdict of the jury for the defendant on his counter-claim must have been based on a finding that the original contracts were valid and not gambling contracts, and the question is therefore whether the instruction was right, and, if not, whether the error was cured by the verdict of the jury.
We think the charge objected to was erroneous. The cross-action' of the defendant, as an independent suit, it is clear, could not have been maintained. His case, as stated by himself in his answer and counter-claim, was that the money was advanced by him to carry on a gambling transaction, that with his concurrence the money so advanced was used in such gambling transactions, and that by the statutes of Illinois, where the contracts were made, they were treated as gaming contracts and declared illegal and void, and the making of them a criminal offence. The counter-claim thus, stated was supported by the testimony of the defendant himself, given upon the trial. There was no statute of Illinois- to authorize the recovery of money paid on such contracts. The cross- action, therefore, of the defendant, stated in his pleading and supported by his own deposition, was not one on which any recovery could be had. Armstrong v. Toler, 12 Wheat. 258; Brown v. Tarkington, 3 Wall. 377; Davidson v. Lanier, 4 Wall. 447; Hanauer v. Doane, 12 Wall. 342. The court "was bound to take judicial notice of the fact that the dealings recited in the counter-claim were forbidden by law, and of its own motion should have directed a verdict against the defendant thereon. Oscanyan v. Arms Company, 103 U. S. 251. If the defendant had withdrawn his counter-claim and docketed it as a separate suit against the plaintiffs, as permitted to do by .the code, it needs no discussion to show that his action must have failed. His rights are not changed by the fact that"the two causes go on pari passu, and are tried at the sana time. We do not see on.what ground a party, who says in his plead-' ing that the money which he seeks to recover was paid out for the accomplishment of a purpose made an offence by the law, and who testifies and insists to the end of his suit that the contract on which he advanced his money was illegal, criminal, and void, can recover it back in a court whose duty it is to give effect to the law which the party admits he intended to viólate.
In the present case the plaintiffs alleged and insisted that their transactions with the defendant were.carried on with no. unlawful purpose. On the other hand, the defendant alleged and insisted that in the same transactions he intended to violate the law. We see no reason why in such a case the plaintiffs might not, if they had not cancelled the contracts, recover the money paid by them for the defendant, while at the same time the defendant could not recover the -money advanced to the plaintiffs for what he intended to be an unlawful purpose.
In Holman v. Johnson, Cowper, 341, 343, it was said by Lord Mansfield that " the objection that a contract is immoral or illegal as between plaintiff and defendant sounds at all times very ill in the mouth of the defendant. It is not for his sake, however, that the objection is ever allowed ; but it is founded on general principles of policy, which the defendant has the advantage of, contrary to the real justice as between him and the plaintiff, by accident, if X may so say. The principle of public pojicy is this ex'dolo-malo non oritur actio. No court will lend its aid tó a .man who fpunds his cause of action upon an immoral or illegal act. If from'the plaintiffs' own stating, or otherwise, 'the pause of action appear to arise ex turpi causd, or the transgressipn of a positive law of this country, there the court says he has no right to be assisted. Xt is upon that ground the court goes not for the sake of the defendant, but because they will not lend their aid to such a plaintiff. So if the plaintiff and defendant were to change sides and the defendant was to bring his action against the plaintiff, the latter would then have the advantage of it; for when both are equally in fault potior est conditio defendentisP
If, therefore, the defendant intended to embark his money in an illegal and criminal venture, we do not see how his case is helped by the fact that the purpose of the plaintiffs was to invest the money so advanced in what they understood to be a lawful and innocent transaction.
The paragraphs of the charge of the court excepted to amounted in substance to this, that if the plaintiffs, in making the contracts for the defendant, contemplated and intended an actual purchase and an actual sale, but the defendant did not, but, on the contrary, meant to engage in a gambling venture, ' the contract would, nevertheless, be binding on both parties, and if the plaintiffs cancelled the contracts, the defendant, notwithstanding his intention to violate the laws, could recover from the plaintiffs the money advanced.by him to carry out his unlawful purpose. We think this charge was erroneous. Upon the case" made by his counter-claim, the defendant was not entitled to recover, and the fact that the plaintiffs werepnnocent of any unlawful purpose did not énure to the benefit of the defendant, . Who' confessed that the money which he sought to recover had . been paid by him to promote an illegal and criminal venture.
Upon the pleadings the verdict of the jury cannot help the defendant's case. Section 5328 of the Revised Statutes of Ohio of 1880 provides " that when upon the statements in the pleadings one, party is-entitled by law to judgment in his favor, judgment • shall." be so rendered by the court, though a verdict has been found against such party." It is clear that, upon the' defendant's counter-claim, which showed that he had no valid cause of action against the plaintiffs, no valid judgment could be rendered against them. Notwithstanding the verdict, the judgment should have been against the defendant, and for the plaintiffs, upon the counter-claim of the former.
¥e are of opinion, therefore, that
The judgment in favor of the defendant on the cause of actioro alleged in the plaintiffs' petition should he affirmed, amd the jiodgment in favor of the defendant, on the cause of action set up in his answer hy way of cou/nter-claim,% should he reversed, and the cause remanded with directions to enter a judgment for the plaintiffs and against the defendant on the counter-clmm of the latter.