Opinion by
Mr. Justice Stewart,
The Monongahela National Bank of Brownsville, plaintiff, on November 7 or 8, 1907, transmitted to the First National Bank of California, defendant, for collection, from the People’s Bank of California, a check of which the following is a copy:
“$5000.00 California, Pa., July 16, 1907.
“PEOPLES BANK OF CALIFORNIA, PA.
“ Pay to the order of W. L. Lenhart
“ Five Thousand Dollars
“Cashier’s Check
“ O. F. Piper, Cashier
“ Indorsed:
“Monongahela Natl. Bank
“Brownsville, Pa.”
The check was received by the defendant bank on the morning of November 8, and was promptly presented by it, on the same morning, at the counter of the People’s Bank. It was as promptly redeemed by that bank and marked paid, the defendant bank receiving upon its surrender payment in full. It is wholly immaterial that the payment was made by a draft. It is agreed that the draft was the equivalent of cash, and it is unnecessary for the purposes of the case to follow its history. During the afternoon of the same day the People’s Bank made demand on the defendant bank for a return of the money paid to it on the check, alleging that payment had been made *273through mistake; that the bank had discovered, since payment, that the check was fraudulently issued by Piper its cashier, and that it represented no indebtedness of the People’s Bank. The defendant thereupon returned to the People’s Bank the money paid, and received back the check, which it promptly returned to the plaintiff bank with notice that payment was refused. The action was brought to recover from the defendant bank the amount it received from the People’s Bank as the plaintiff’s collecting agent. The defense set up was that the cashier’s check had been issued by Piper to Lenhart in fraud of the People’s Bank, and that the plaintiff bank was chargeable with notice of the fraud before its acceptance of the check. The case was submitted to the jury with the following instruction, which was an affirmance of one of defendant’s points. “ If the jury find that the cashier’s check for 15,000 was issued by O. F. Piper to W. L. Lenhart without the receipt by the People’s Bank of California of any consideration therefor, and in fraud of said bank; that at the time it was taken by the cashier of the Monongahela National Bank, he knew or had reason to believe the fraudulent character of the check; that at the time the assistant cashier of the People’s Bank gave to the First National Bank a Pittsburg draft in payment for said check, he was ignorant of the fact that it had been issued without consideration, and fraudulently; that later in the same day and while the money so received by the First National Bank was still in its control, demand was made upon it by the People’s Bank to return said draft and take back the cashier’s check on the ground that the payment thereof had been made by a mistake of fact, and in compliance with such demand the First National Bank thereupon did return said draft and take back the cashier’s check; that thereupon said cashier’s check was protested and returned as unpaid to the plaintiff bank, which with knowledge of the fact that the First National Bank had so given back the Pittsburg draft and taken back as unpaid the cashier’s check, retained said check after getting it on November 9, 1907, until the bringing of this suit on June 8, 1908, the verdict should be for the defendant.” No complaint *274is made with respect to this submission of the case, other than that there was not sufficient evidence to support a finding that at the time plaintiff’s cashier accepted the check from Lenhart, it knew or had reason to believe that the check had been uttered fraudulently. The plaintiff’s contention is that the evidence on this branch of the case was insufficient. Plaintiff asked instruction that under all the evidence in the case the verdict should be for the plaintiff. This was refused, and the refusal is made the subject of the twelfth assignment of error. Had the action been against the People’s Bank on the cashier’s check, the defense here set up would have been entirely proper, and conclusive if established by the evidence. But it by no means follows that because proper in that case it is available in this. The cause of action not being the same in one case as in the other, the parties defendant necessarily stand in different rights. Here the action is not based on the check, and the liability that is asserted against the defendant arises out of a fact occurring after defendant’s agency in connection with the check had ceased. After the defendant had surrendered the check, it had in its hands money which it had received for the plaintiff, and it is for the recovery of this that this action for money had and received was brought. Therefore it is, that if the defense set up here can avail the defendant, it must be for other reasons than because it would avail the People’s Bank in a suit on the check. We think it equally clear that any other that could be suggested would be quite as insufficient. Since the defendant stood toward the plaintiff, with respect to the money in his hands, as agent, and since its liability did not arise directly from the check, and did not in any way depend on the integrity of the transaction from which the money resulted as between the plaintiff and the party who paid it over, the issue warranted no inquiry with respect to the origin of the check or the manner in which plaintiff acquired title to it. In allowing defendant to enter upon such inquiry a settled rule of law was disregarded. An agent may not be allowed to deny the title of his principal to the subject-matter of the agency. The check was not the subject-matter of the agency, for agency with respect to it terminated *275when the check was surrendered; it was the money which the agent had received for its principal which was the subject-matter. More than this; admitting the facts with respect to the check to be as claimed, that it was issued in fraud of the People’s Bank and that the plaintiff in accepting it was chargeable with notice of the fraud, these facts would establish no legal defense to plaintiff’s demand. Nothing but payment to the plaintiff, or what would be its equivalent, payment to another under legal compulsion, could acquit the defendant of liability. It is never a defense to an action by principal for money collected by the agent, for the latter to show that in equity and good conscience the money belonged to a third party. Of course it is open for the defendant to show that the subject-matter of the agency was an illegal or immoral transaction, or that it was founded in fraud; and when either of these is shown the principal will not be allowed redress against the agent touching the transaction; but here nothing of this kind could be alleged of the subject-matter of this agency, which was money had and received by the agent. The taint that was upon the check was not communicated to the money that was paidjior its redemption. The distinction is made very clear in Story on Agency, p. 279, editor’s note, from which we quote, “But, where the recovery from an agent is not sought through or upon, the illegal contract, but upon the new collateral contract, not illegal, there it may be recovered. Thus, if an agent has received money from third persons for his principal by his authority, which money accrued from an illegal transaction between the principal and such third persons, who have no connection with the agent, the principal may recover it from his agent, for, as between them, the receipt of the money for the principal is upon a legal contract, although the money itself accrued under a former illegal transaction.” That the principle here stated has received general recognition in the courts of this country abundantly appears from the list of cases cited in 31 Cyc. of L. & P., pp. 1483-1484, in support of the following text: “An agent cannot be compelled to account for funds or property received by him for his principal in the course of an illegal transaction where the right of re*276covery and the illegal transaction are so closely connected that the principal cannot enforce his right without showing the illegality. But where the illegal transaction has been completed, and the principal relies for his right to an accounting upon a collateral and independent obligation not connected therewith, the agent may be compelled to account for the funds or property so received, although arising out of the illegal transaction, and will be precluded from setting up the illegality of the transaction as a defense.” Our own authorities are quite as explicit as to the only test to be applied when such defense is set up. It is only necessary to refer to Swan v. Scott, 11 S. & R. 155, where it is said: “The test whether a demand connected with an illegal transaction, is capable of being enforced at law, is whether the plaintiff requires the aid of the illegal transaction to establish his case. If a plaintiff cannot open his case without showing that he has broken the law, a court will not assist him, whatever his claims in justice may be upon the defendant, and if the illegality be malum prohibitum only, the plaintiff may recover, unless it be directly on the forbidden contract.” There is no question here of ratification by the plaintiff of the unauthorized act of its agent in repaying the money to the People's Bank. The check was returned to the plaintiff with notice of protest for nonpayment, without any intimation that it had been once paid, and that the money had afterwards been refunded. There was evidence to the effect that several persons connected with the People’s Bank had told plaintiff’s cashier that the check was a fraud on the bank, and that the bank would not redeem it; but it nowhere appears that the fact that the check had actually been paid to its agent, and the money refunded by the latter was even brought to the attention of the plaintiff. It follows from what we have said that plaintiff was entitled to an affirmance of its third point, which was that “ under all the evidence in the case the verdict should be for the plaintiff.” The refusal of the point is the subject of the twelfth assignment of error, and this assignment is, sustained. The judgment is reversed and judgment is now entered for the plaintiff.