In substance the complaint states: A lease by defendants to plaintiffs of piers in East river; an action by defendants against the city of New York for injury to the piers, and judgment in their favor for the sum of $52,330.01, damages they had sustained by the injury to the piers; the wrongful receipt of this money by the defendants, because the money so received by them embraced *165the damages occasioned to the plaintiffs by the injury to the piers; a demand of judgment for a sum equivalent to the damages sustained by the plaintiffs from the injury to the piers.
The concession in the complaint that the money recovered by the defendants was for the damage they had sustained by the injury to the piers is at once fatal to the complaint, since it admits that the money was not received to the plaintiffs’ use, but in reparation of a wrong the defendants themselves had suffered; and so the defendants are not bound, ex aequo et bono, to refund to the plaintiffs. The action for money had and received, proceeding upon equitable principles, is defeated by an equal equity in the defendant, and he is never held to return what he may keep with a good conscience. 2 Greenl. Ev. § 117; note to Bank v. Eltinge, 100 Am. Dec. 523; Buel v. Boughton, 2 Denio, 91, 93; 4 Wait, Act. & Def. 511. As this allegation in the complaint may have been unnecessary and 'inadvertent, and as it is desirable to dispose, of the demurrer upon grounds which no amendment may obviate, I shall assume the pleading to state the transaction in the aspect most favorable to the plaintiffs, namely, that the city of New York was liable to the plaintiffs in the sum they demand for injury to their interest in the piers, and that this sum the defendants have received from the city upon an invalid claim that it was due to them. Still the action is untenable. The principle decisive of the case is: “That if two or more independent claimants apply to the debtor for payment, and the debtor pay the claimant not entitled thereto, the unsuccessful claimant cannot maintain an action for money had and received against the successful claimant to recover the money so paid.' * * * If, however, the payment, though made to the wrong person, operates as a payment of the claim, so that the rightful claimant can no longer assert his claim against the party paying, then the defendant has in fact received money which belonged to the plaintiff, and the plaintiff should be allowed to recover the money so paid.” Keener, Quasi Cont. 168. That the city’s liability to the plaintiffs was not discharged by the pajonent to the defendants is settled by conclusive authority. Atlantic Dock Co. v. Mayor, etc., 53 N. Y. 64; Rowe v. Bank, 51 N. Y. 674; Hathaway v. Town of Homer, 54 N. Y. 655; Sergeant v. Stryker, 32 Am. Dec. 404, 405. This being so, the invalidity of the plaintiffs’ contention is clear beyond controversy. Patrick v. Metcalf, 37 N. Y. 332; Butterworth v. Gould, 41 N. Y. 450; Rowe v. Bank, 51 N. Y. 674; Hathaway v. Town of Homer, 54 N. Y. 655; Decker v. Saltzman, 59 N. Y. 275; Peckham v. Van Wagenen, 83 N. Y. 40; Fox v. McComb (Sup.) 18 N. Y. Supp. 611; Moore v. Moore, 127 Mass. 22; Rand v. Smallidge, 130 Mass. 337; Hall v. Carpen, 27 Ill. 386, 29 Ill. 512; Kelley v. Lindsey, 7 Gray, 287; Sergeant v. Stryker, 32 Am. Dec. 404,—a case identical in principle with the present, and instructive in its exposition of the action for money had and received. Demurrer sustained, and judgment for defendants.