delivered the opinion of the court February 13th 1882.
This suit was for money defendant had collected under a letter of attorney from the legal plaintiff. It authorized him to collect of a certain tenant of the plaintiff, the rents of a property specified, and directed him to pay the same to lien creditors named, designating the order of payment, and to pay the residue, if any, over to the plaintiff. The defendant collected rents, but failed to pay the same according to directions. He held a judgment against the legal plaintiff, aud on the trial of this cause was permitted to set it off, and recover a judgment against Tagg, for the amount which it exceeded the rents in his hands. The allowance of this judgment, as a set-off, is assigned as error.
While a liberal construction is given to the Act of 1705 allowing set-off and defalcation of a debt of a proper character, yet, as a general rule, the debt must be due in the same right. It is inadmissible when the plaintiff’s cause of action is for a breach of contract to fulfill an official, or a fiduciary obligation. Although the debt may be between the same parties, yet it is not due in the same right within the true meaning of the statute. Hence the treasurer of a corporation, vdien sued for money in his hands as treasurer, cannot set off a debt due him from the corporation: Russell v. Church, 15 P. F. Smith 9. So in an action by a collector of school taxes, for taxes assessed on the defendant, the latter cannot set off a debt due him from the board of school directors: McCracken v. Elder, 10 Casey 239.
A party may also, by agreement, debar himself from pleading a set off: Hennis v. Page, 3 Whar. 275; United States Bank v. Macalester, 9 Barr 475; Carman v. Garrison, 1 Harris 158. The agreement need not be express, but may be implied; Ardesco Oil Co. v. N. A. Mining and Oil Co., 16 P. F. Smith 375.
By accepting the letter of attorney the defendant assumed *380the obligation, and assented to the terms, therein, imposed on him. It thereby became his duty to collect the rents and pay over the same to the several persons, in the amount therein specified. ITis right to retain any portion thereof, or to apply it to the debt due him was expressly limited to the interest thereon. PLis power to collect was coupled with the specific trust prescribed in the same instrument. Having received the money under authority of the plaintiff for a specific purpose, he cannot apply it to the payment of a previous indebtedness. It cannot thus be diverted from its legitimate purpose: Jarvis v. Rogers, 15 Mass. 397; Turnpike v. Watson, 1 Rawle 330. The parties being competent to contract, and the terms thereof not contrary to any law, there is no just reason why they shall not be faithfully observed. An agent cannot avail himself of an advantage given by his agency to apply it to his own benefit to the injury of his principal: Parkist v. Alexander, 1 Johns. Ch. 397.
The evidence fails to disclose under what circumstances Weeks, the use plaintiff, acquired the claim. If for value, and in good faith, no judgment should be recovered against the legal plaintiff, in this suit, as it then is not prosecuted for his use or benefit. The assignments are sustained.
Judgments reversed, and a venire facias de novo awarded.