delivered the opinion „ of the court.
On a former appeal in this case (29 Mont. 240, 74 Pac. 448) á judgment in favor of the plaintiff and an order denying defendant’s motion for a new trial were reversed because of error committed by the court in exeluding certain evidence. On the second trial the court sustained a motion for nonsuit, and directed judgment for the defendant. The present appeal is from the judgment.
*111The only question now before us is whether the evidence introduced by plaintiff at the trial made out a ease for the jury. In brief the facts are: The defendant, as sheriff, under an attachment issued out of the district court of Gallatin county in an action entitled “Ira De Long v. Bert and Thomas Michener,” the plaintiff herein, attached in the hands of one Yreeland a debt due from him to one or both of the defendants, amounting to $136.65. Subsequently Yreeland paid the amount of the debt to the defendant, who held it to await the result of the action. Afterward De Long dismissed the action as to the plaintiff, and judgment was entered in his favor. Thereupon he made demand upon the defendant for the amount so paid by Yreeland, claiming that the debt was due him, and that Bert Michener had no interest in it. This demand was refused, whereupon this suit was brought.
At the trial it appeared that Yreeland was under contract to build a bridge for Gallatin county over the West Gallatin river, he having assumed a contract originally let to one Thorpe. He contracted with plaintiff for lumber necessary for that purpose, and the lumber was furnished. It was obtained from logs furnished on shares by plaintiff to one Blanchard and Bert Michener, who were running a sawmill. In this mill plaintiff had no interest. It appears that after the lumber was manufactured from the logs furnished it was divided between Blanchard and Bert Michener on the one hand, and the plaintiff on the other, each taking the share agreed upon.
From this brief statement it is apparent that the debt attached by the defendant was due Thomas Michener alone. The relation between Bert and Thomas Michener created by the furnishing of the logs to be manufactured into lumber by Blanchard and Bert Michener, Thomas Michener taking his share of the product, was not such as to render the latter liable for any of the obligations of Bert Michener, and the evidence was sufficient to make out a prima facie case for the jury, if, as a matter of law, a sheriff is bound to account to a successful defendant in an attachment suit for moneys collected under the attachment *112from such defendant’s debtor. The district court seems to have proceeded upon the theory that payment of the debt to the sheriff by Yreeland was voluntary, and that there is no privity, statutory or contractual, between the plaintiff and defendant upon which the plaintiff may sustain this action. For obvious reasons this theory is erroneous; for, independently of the equitable rule deduced from the decisions, to the effect that, when the defend'ant has received money which in equity and good conscience belongs to the plaintiff, he ought not to be allowed to retain it, it is clear that the facts of this ease bring it within the provisions of sections 903 and 911 of the Code of Civil Procedure. Under the former the sheriff may collect the debts and credits of the defendant which have been attached. His receipt operates as a discharge of the debtor. Under the latter, if the defendant recovers judgment, all proceeds of sales made under the attachment, moneys collected, and all property attached remaining in the sheriff’s hands must be delivered to the defendant or his agent. Thus the duty of the defendant upon the dismissal of the action against the plaintiff in this ease was clear, provided only it appeared that the money belonged in fact to the plaintiff. The burden then rested upon the plaintiff to show the debt was due from Yreeland to himself. When this was made to appear, a case was made upon which he was entitled to recover. The burden was then cast upon the defendant to show, if he could, that such was not the fact, but that he was entitled to hold it to apply upon the judgment which De Long might recover in the action against Bert Michener; otherwise the plaintiff, by the mistake of De Long in making him a defendant, and by Yreeland’s payment to the sheriff under the attachment, thereby obtaining a discharge of his obligation to the plaintiff, would be deprived of his property without remedy against anyone.
During the argument attention was called to the case of Merchants’ and Miners’ National Bank v. Barnes, 18 Mont. 335, 56 Am. St. Rep. 586, 45 Pac. 218, 47 L. R. A. 737. It was urged by counsel for defendant that it is decisive of this case. There *113is, however, a broad distinction between the two. The mining company, garnishee in that case, with full knowledge that the debt due from it to Tyler, the defendant, had been assigned to the plaintiff, assumed to pay it to Barnes, who actually applied it to the satisfaction of the judgment against Tyler. By the payment to Barnes after notice of the assignment by Tyler, the mining company did not discharge the debt. It voluntarily paid when it should not have done so. Barnes was not obliged to disregard the acknowledgment of its liability by the company to Tyler and desist from further proceedings under the writ, nor was he obliged to refuse payment of the amount admitted to be due. In doing as he did he committed no wrong to the bank, because the mining company’s obligation to the bank was not discharged by its payment. In the case at bar Yreeland was indebted to the plaintiff, who was a defendant in the action of De Long v. Michener. Payment of the debt was properly made to the defendant under the writ under section 903, supra, and discharged Yreeland. When the action was dismissed as to plaintiff, and judgment entered in his favor, the defendant was, under section 911, supra, clearly bound to account to him for the money collected from Yreeland. The issue to be tried was whether the debt was due to plaintiff. This view was entertained by this court on the former appeal.
The court, therefore, erred in sustaining the motion for non-suit and rendering judgment for the defendant. What has been said, of course, must be understood to apply only to the caes as presented to this court. On a new trial the defendant will have the opportunity to rebut the ease made by plaintiff, and it will be a question for the jury as to whether or not the plaintiff is entitled to recover. The judgment is reversed, and the cause is remanded for further proceedings.
Reversed and remanded.
Mr. Justice Milburn concurs.
Mr. Justice Holloway, being disqualified, takes no part in the foregoing decision.