On the 16th day of February, 1895, a firm having sixty-five creditors, and tvith the knowledge and consent of but three of them, made and filed a chattel mortgage on all its personal property to secure the amount due each of its creditors. Afterward, three of the creditors, namely, the Avery Planter Company, which we shall hereafter call the plaintiff, the First National' Bank of Pawnee City, which we shall hereafter call the defendant, and Maggie Wishard, being among the number without whose knowledge or consent the mortgage was given, brought separate actions against the firm, and caused attachments to be levied on the personal property covered by the chattel mortgage, and on certain real estate belonging to the firm. The defendant’s attachment for $4,283.86 was levied first, that of Maggie Wishard for $152.10 was next in point of time; that of the plaintiff for $271.44 was levied last. Motions, all based on the same ground, were made to dis*331solve these attachments, were heard on the same evidence and were overruled. A judgment was rendered and an order for the sale of the attached property made, in each case, in favor of the plaintiffs in attachment. Error was prosecuted from the judgment in favor of the defendant in this case to this court, Avhere the order sustaining the attachment was reversed and the attachment dissolved, but the judgment on the merits affirmed. Neither the order of the district court sustaining' the attachment nor its judgment on the merits, was stayed by a supersedeas. The case is reported under the title of Skinner v. First Nat. Bank of Pawnee City, 59 Neb. 17.
After the actions in attachment were begun, and before the writs' were levied, the attaching creditors, in anticipation of a claim to the personal property by some of the mortgagees, each gave the sheriff an indemnifying bond to hold him harmless from any damages that might result to him by reason of a levy of the attachments on the property in question. After the attachments were levied certain of the mortgagees brought an action in replevin against the sheriff to recover possession of the mortgaged property. The property was not delivered to the plaintiffs in that action and the case proceeded as one for damages. All of the attaching creditors joined in the defense of that action although they were not parties to the record. The action in replevin resulted in a judgment in favor of the mortgagees and against the sheriff for $4,089.87 and costs of suit. The sheriff prosecuted error to this court where the judgment was affirmed. Sloan v. Thomas Mfg. Co. 58 Neb. 713. In resisting the action in replevin the attaching creditors acted in good faith, and in the honest belief that the sheriff was entitled to the possession of the property, as against the mortgagees, by virtue of the attachments, and that the property was liable for the satisfaction of their respective claims, but not in pursuance of' any agreement between them.
While the case last cited, and that of Skinner v. First Nat. Bank of Pawnee City, supra, were pending in this *332court, by stipulation of all the parties to the attachment cases, the sheriff was appointed receiver of the personal property and advertised and sold the same, reporting his proceedings to the district court where his report was confirmed. He was then directed by the court to hold the proceeds, pending the result of the action in replevin. The real estate was sold by the sheriff, pending said action, under an ordinary order of sale issued in favor of the bank, and the proceeds, amounting to $505, applied on its judgment. The defendant was the purchaser at such sale, and afterward, and before the commencement of this action, conveyed the land to a stranger. After the defendant’s attachment had been dissolved, by virtue of the decision of this court in Skinner v. First Nat. Bank of Pawnee City, supra, certain of the mortgagees who had' been excluded from sharing in the judgment in replevin, because they did not accept the mortgage until after the levy of the attachment, commenced an action in equity to share in the proceeds of the judgment in replevin. In this action the sheriff was ordered to apply the proceeds in his hands, as receiver of the personal property, on the judgment in replevin, which was done. Such proceeds were not sufficient to satisfy the judgment, and the defendant paid the deficiency, amounting to $1,703.30, and, in addition thereto, some costs and expenses incurred in the action in replevin, making a total of $1,872.08.
Afterward, and after the dissolution of the defendant’s attachment, the plaintiff brought this action against the defendant for restitution to the extent of its judgment, out of the money which the defendant had realized on its judgment by a sale of the'real' estate before its attachment was dissolved. The defendant pleaded a counter-claim for contribution for the amount paid by it on the judgment in replevin, and certain costs and disbursements incurred and made by it in that action.
Portions of the answer containing, among other things, allegations showing the good faith of the .attaching creditors, in directing their levies, and in resisting the action in *333replevin, were stricken out on motion of the plaintiff. The plaintiff then demurred to the counter-claim on the grounds that the facts stated were not sufficient to con'stitute a cause of action in favor of the defendants, and that there was a defect of parties, because Maggie Wishard was a necessary party to a determination of the issues tendered by the counter-claim. The demurrer was sustained. A trial resulted in a finding and judgment for the plaintiff. The defendant brings error.
Numerous errors are assigned and argued, but they render themselves into two questions, namely, whether on the facts stated the plaintiff has a cause of action against the defendant, and, whether, on the same state of facts, the defendant has a cause of action against the plaintiff for contribution? We shall consider these questions in their order. The case has been argued on the assumption that it is one for restitution.
In Hier v. Anheuser-Busch Brewing Ass'n, 60 Neb. 320, it was held that a set-off would not be allowed in an action for restitution; the reason being that the court, having, through a mistaken view of the law, wrongfully taken the property of one and given it to another, would not seek to adjust equities between them until it had restored the party injured to the position he occupied before the wrongful order of the court was enforced against him. The right of the defendant to ask contribution against the plaintiff and to enforce it in this case rests, therefore, upon the question whether this action is one of restitution or- for money had and received and for which, the common law action of assumpsit could be maintained.
While this is termed an action of restitution, I have grave doubt if such is really its character, as restitution, properly speaking, is made only to a defendant whose money or property has been taken from him by the erroneous order of a court and is not available to third parties. Garr v. Martin, 20 N. Y. 306. In this case three parties, the bank, Maggie Wishard and the Avery Planter Company, procured to be issued and levied upon the real estate *334in question attachments in the order above named. According to, priority of levy the bank had the first lien, . Miss Wishard the second, and the Avery Planter Company the third. These attachments were all 'based on the same grounds and, in a motion made to dissolve them, the same evidence was taken .and relied on by the defendant in support of his motion to dissolve, while the three attaching plaintiffs each used the same evidence to sustain their writs. The district court sustained the attachments, gave judgment in each case for the amount of the plaintiff’s respective claims, .and ordered a sale of the attached property. The defendant in these actions took error to this court in one case only, that of the bank, where the judgment on the merits was affirmed, but the order of the district court sustaining the attachment was overruled and the attachment dissolved. Skinner v. First Nat. Bank of Pawnee City, 59 Neb. 17. In the meantime the defendant having failed to give a supersedeas bond, the bank sold the attached real estate, being itself the purchaser, for the sum of $505, which was applied on its judgment. In this condition of the case, this action was commenced against the bank by the Avery Planter Company, which asserts that the attachment of the bank having been dissolved, its claim to ,a first lien was thereby devested while the lien of Miss Wishard was advanced to a first lien and that of the company to second place, entitling these parties to the value of the property which the bank had appropriated under its void attachment and the value of which was sufficient to satisfy the judgments of both Miss Wishard and the company.
If Skinner, the attachment defendant, had brought this action, then, on the authority of Hier v. Anheuser-Busch Brewing Ass’n, supra, it is plain that the bank would be compelled to refund to him the value of the properly sol'd under an attachment held good by the judgment of the district court, but afterwards declared by this court to have been illegally issued, and the hank would not be allowed to set off a demand held by it against Skinner to *335cancel or reduce the amount of his recovery, the theory being that the court Avill restore to a party money or property taken from Mm by another under a Avrqngful order made by the court and place him in the same position he occupied before the illegal order Avas made.
The Avery Planter Company does not, hoAvever, occupy, in this respect, the same position held by the defendant in the attachment proceeding. The court decided no controversy betAveen attaching creditors. It made no decision against the attaching creditors Avhose Avrits were levied subsequent to that of the bank. It took from them no right for Avhich they were contending as against the bank, and unless- one has been wrongfully compelled by the court to abandon a position which he was defending, he is not entitled to restitution regardless of the equities of the party against whom he is seeking to enforce such a claim. In this case the lien of the Avery Planter Company was advanced from third to second place, not on account of any action of its own or of any merit or equities it possessed over the bank, but solely because Skinner, the defendant whom all Avere pursuing, elected to appeal from the order of the district court sustaining the bank’s attachment against his property and having that order reversed. We think that under such conditions the bank is entitled to plead any set-off it may have against the Avery company.
It is true that in the attitude the case has finally assumed, Miss Wishard and the Avery Planter Company are entitled to the property sold by the bank under what, at the date of the sale, was supposed to be a first lien and to appropriate that property or its value to the satisfaction of their judgment. This right arises in this way. At the time the property was sold it was held by the sheriff under the three Avrits sued out by the attaching creditors; the defendant questioned the right of all the creditors to an attachment against him, and, being defeated in his contention in the district court, appealed to this court in the bank case and secured a decision that the writ of the bank was illegally *336issued.- Prior to this decision being made, the sheriff had sold the pi’operty for the bank and had, in effect, paid over the proceeds, the bank being the purchaser. When it was finally decided that the property was sold on a void attachment lien, the proceeds of the sale, or the value of the property sold, should have been returned by the bank to the sheriff who would then hold it for the benefit of the subsequent attaching creditors whose writs had not been set aside. When the bank appropriated this property it knew that its right to do so was being litigated in the supreme court, and the law raised an implied promise on its part to refund the value of the property to the sheriff for the benefit of the other parties for whom he had levied, in case it should finally be determined that the sale was wrongfully made. This implied promise will now be enforced, and the law is well settled that a third party for whose benefit a promise or contract is made may maintain an action in his own name. The action is clearly one for money had and received and against which a counter-claim may be pleaded. Miss Wishard and the Avery Planter Company may, therefore, maintain an action against the bank for the value of this property.
The defendant contends that plaintiff’s cause of action is barred by the statute of limitations. The plain answer to this is that the plaintiff’s right to bring this action did not and could not accrue until, by the determination of this court, the attachment under which the defendant claimed and came into possession of the money was adjudged invalid, and this was less than four years before the commencement of this action. Defendant also contends that it is entitled to contribution for the amount paid by it on the judgment in replevin, and for certain disbursements made by it in that action. In this view we are disposed to concur. It is true, as urged by the plaintiff, that the mere ■levy and indorsement of the write of the plaintiff, and the other attaching creditor, did not make them joint trespassers with the bank. So far as appears from the record, in directing the levy to be made, the parties acted inde*337pendently of each other. The levy of each writ, therefore, was a separate trespass, for which the parties participating therein alone were liable. Bat the parties did not stop there. ■ After notice of the claim of the plaintiffs in replevin they joined in the defense of that action. The result in the action in replevin is conclusive on the point that the possession of the sheriff was tortious. By assisting in the defense of that action the attaching creditors, one and all, ratified the tort and became liable as trespassers ab initio, Cole v. Edwards, 52 Neb. 711. The attaching creditors, having thus joined in the defense of the action in replevin, are as effectually concluded by the judgment rendered therein as though they had been parties to the record. 2 Black, Judgments, sec. 539. Such judgment, therefore, was a joint liability, and upon its discharge by one of the parties liable, a cause of action arose in favor of such party against the others, for contribution. Vandiver v. Pollak, 107 Ala. 547, 54 Am. St. Rep. 118; Farrwell v. Becker, 129 Ill. 261, 21 N. E. 792. The general rule that contribution among tort-feasors will not be enforced, does not apply where, as in this case, the pair ties acted in good faith without any intention of committing a trespass. Johnson v. Torpy, 35 Neb. 604, and the cases last above cited.
On what basis contribution should be enforced is a question of some difficulty. In Vandiver v. Pollak, supra, it is held, that the parties should contribute equally, without regard to the amount of their respective attachment liens. We can not assent to that rule. The right to contribution results from natural equity, and its enforcement is an application of the principle, that one should be compelled to do that, which, in equity and good conscience, he ought to do; that being true, it should be enforced according to the rules of equity, and its enforcement should stop short, of the point where it becomes unjust and oppressive. To enforce contribution in the'present instance according to the rule under consideration, it seems to us Avould be manifestly unjust. The attachment lien of the defendant *338was for $4,283.80; that of the plaintiff was for $271.44; that of the other creditor, $152.10. These amounts, respectively, are the measure of the interest of the several attaching creditors in the result of the litigation in the action of replevin. Their joining in the defense of that action was not in pursuance of any agreement, hut was merely the result of a desire on the part of each to protect his own lien. It would seem that the case is analogous to that of where the'estates of two or more persons are affected by a common incumbrance, which one of them pays. In such case, contribution is enforced in proportion do the value of the several estates. Morrison’s Administrator v. Beckwith, 4 Mon. (Ky.) 73, 16 Am. Dec. 136. The defense, in the action of replevin, in a certain sense, was a joint venture, and there would seem to be no good reason why the losses should not be apportionéd according to the interest of the respective parties in the result, as in other joint ventures. The rule announced in Vandiver v. Pollak, supra, to a man of ordinary prudence, situated as was the plaintiff when the action in replevin was brought, would amount to a prohibition against protecting his rights in such action, because the risk, under such rule, would be out of dll proportion to all he could hope to gain. We conclude, therefore, that the defendant is entitled to contribution for the amount paid by it in discharge of the judgment, and the reasonable expense incurred in defense of the action; but that the amount should be apportioned according to the ratio the several attachment liens bear to each other.
It will be observed that the plaintiff demurred to the counter-claim on the ground of a defect of parties, as well as generally. By the general demurrer the facts pleaded in the counter-claim stand admitted. If those facts be true, then the defect of parties, if there be a defect, goes to plaintiff’s cause of action as well as that stated in the defendant’s counter-claim; the other attaching creditor, if a necessary party to a determination of the counterclaim, is also a necessary party to the canse of action *339stated in the plaintiff’s petition. The plaintiff having omitted a necessary party to the action, can not be heard to complain that snch party is a necessary party to a determination of the issues tendered by 'the counter-claim, and is not before the court. We do not mean to be understood to hold that the other attaching creditor was a necessary party in either case.
It should be noted in this connection that the demurrer tp the cpunter-claim was interposed after the portion of the counter-claim, showing good faith on the part of the attaching creditors in making the levy and resisting the action in replevin, had been stricken out on plaintiff’s motion. With this matter stricken out, the counter-claim was vulnerable to a demurrer, because it showed nothing to remove the case from the operation of the general rule against the enforcement of contribution between wrongdoers. Technically, therefore, the ruling on the demurrer was right, but the ruling on the motion was erroneous. The motion should have been overruled, and then the counter-claim would have been good as against a general demurrer.
It is recommended that the judgment of the district court be reversed and the cause remanded for further proceedings according to law.
Ames and Albert, CO., concur.By the Court: For the reasons stated in the foregoing opinion, the judgment of the district court is reversed and the cause remanded for further proceedings according to law.
Reversed,