It is settled, in this state, that an action will lie to recover back money paid upon a judgment which is afterwards reversed. Clark v. Pinney, 6 Cow. 297 ; Maghee v. Kellogg, 24 Wend. 32. In Clark v. Pinney it was laid down as a general proposition, that an action lies in all cases where the defendant has in his hands money which ex ceguo et bono belongs to the plaintiff. “ When money,” says Chief Justice Savage, “ is collected upon an erroneous judgment, which, subsequent to the payment of the monej'-, is reversed, the legal conclusion is irresistible, that the money belongs to the person from whom it was collected; of course, he is entitled to have it returned to him.” In that case the action was brought by the defendant in the judgment, from whom the money was collected upon execution. In this case it is brought by the assignee of one of the sureties, *363on a bond given to tbe defendant Martin, conditioned that tbe sureties would pay tbe damages and costs upon a judgment recovered by Martin in this court, and brought by writ of error to the Supreme Court, if it should be affirmed. The judgment was affirmed, and the plaintiff’s assignee, after a suit was commenced against him by Martin on the bond, paid to the defendant Martin the amount of the bond. The judgment was subsequently reversed by the Supreme Court of the United States. The difference between the two courts constitutes no difference in the . application of the principle. The judgment recovered by Martin having been finally reversed, he is not entitled to retain the money paid to him by the plaintiff’s assignor. He has no title to it, but it belongs to the party from whom he received it, to whom, ex aguo et bono, he is bound to restore it.
It is urged that there is no such privity between the plaintiff’s assignor and the defendant as will entitle the former, or his assignee, to maintain an action against the latter. That, upon the payment of the money by the surety, he had his remedy against his principal, for whose benefit he paid it, and that he has no other remedy. That Martin, in consequence of the reversal of the judgment, may be bound to make restitution to tbe defendant in that judgment, but that he is not liable to restore the money to that defendant’s surety. The short answer to that objection is, that there is nothing to restore to the defendant in the judgment, for he never paid anything upon it. He may be liable to his surety, but that liability is discharged if what was paid by the surety is restored to him by the defendant, and to effect that object it is not necessary to turn the surety over to his action against the judgment-debtor, and the judgment-debtor to an action against the defendant. The privity between the plaintiff’s assignor and the defendant arises from the bond. Patten, the plaintiff’s assignee, bound himself to the defendant to pay the costs and damages, if the judgment should be affirmed, and the judgment having been affirmed, he fulfilled his contract and paid the money to the defendant, upon a consideration which after-wards totally failed by reason of the reversal of the judgment. *364In Stevens v. Fitch (11 Met. 248), it was held that a privity of contract was implied by law, where a judgment against a defendant, which was subsequently reversed, was paid to the plaintiff by a party who had assumed the responsibility of the suit, and he was allowed to recover it back.
It is further urged that, if the surety can recover the money back, it must be on his principal’s right, and as his assignee, for that otherwise any equities the defendant here may have against the defendant in the judgment would be cut off. But the right of action here is founded upon a payment, the consideration of which having failed, an implied obligation arises on the. part of the defendant to restore it to the party from whoni he received it, and no equities existing between him and ■áSe defendant in the judgment could possibly affect the right of the plaintiff’s assignor to recover back money to which the defendant in the judgment has not, and never had, any title.
It is also insisted that the payment by Patten was not compulsory, but was a voluntary payment made under a mistake of law, and cannot therefore be recovered back. To make the payment compulsory, it was not necessary that Patten should wait until Martin had recovered judgment against him and issued execution, which would have subjected him to the costs of that proceeding. It is sufficient if the payment, when made, .could have been compelled at law. If it could, he was justified in making it, without waiting to be sued, or, as the fact was, having been sued, without waiting until payment was enforced by an execution and levy. The judgment having been affirmed, his liability on the bond was then fixed, and the law would then have compelled him to pay it; and paying it then was not paying it voluntarily under a mistake of law. Bize v. Dickason, 1 T. R. 285 ; Story on Contracts, note 1, to § 407. The reversal of the judgment afterwards does not make it a payment under a mistake of law, for a clear legal liability existed, by the condition of the bond, when the payment was made, which could be enforced as long as the judgment remained unreversed. Patten discharged that liability by payment. 'If he had not, it *365would bave been discharged by tbe subsequent reversal of tbe judgment. Tbe effect of that reversal was, to take away tbe right which tbe defendant bad acquired by tbe affirmance of tbe judgment in tbe Superior Court; and by tbe reversal Patten became entitled to receive back tbe money be bad paid tbe defendant, and an obligation and duty was cast upon tbe defendant to return it to him.
The plaintiff is entitled to judgment upon tbe demurrer, and tbe appeal is dismissed, with costs.
Judgment accordingly.