Chiee JAstice G-abbert
delivered the opinion of the court:
The causes of action upon which suit was brought against appellant are three promissory notes for ten thousand dollars each. According to the complaint these notes’ were executed and delivered to The Nevada Bank of San Francisco1 by The Needles Reduction Company, per Isaac E. Blake, its president, and prior to delivery were indorsed by the defendant, and that the bank thereafter ‘sold and indorsed these notes to one D. G-. Schofield, who, in turn, indorsed and sold them to the plaintiff.
*5The defense interposed was to the effect that the true makers of the notes were The Needles Reduction Company and its president, Isaac E. Blake; that defendant was only a surety on these notes for such makers; that they were the only parties who received or expected to receive any consideration for the execution of such notes; that upon default in their payment the bank caused a writ of attachment to be issued, and levied upon the interest of Blake in certain shares of the capital stock of The Pacific Oil Company,- that while such attachment was in full force and effect the plaintiff purchased the notes in question, and thereafter, by acts specially pleaded, prevented the stock so attached from being applied upon such notes; and that the value of the interest of' Blake in this property was more than sufficient to satisfy and discharge them. At the close of the trial the court, on motion of counsel for plaintiff, directed the jury to return a verdict for plaintiff: The testimony relative to this defense was substantially as follows:
The notes were executed by The Needles .Reduction Company as principal, and indorsed by Mr. Crosby, Mr. Blake and others, who were directors of the company. Mr. Blake informed Mr. Crosby at this time that he would protect him against the liability assumed. The proceeds of these notes were deposited in the bank in the name of The Needles Reduction Company, and subsequently checked out in the name of that company under the direction of Mr. Blake. Mr. Crosby owned no stock in this company except a few shares which had been issued to him for the purpose of. qualifying him to act as a director. Neither had he any interest in the loan, nor the purpose for which the money was borrowed by the company. At the time of the negotiation of this loan, and subsequent, Mr. Blake owned practically all of the *6stock of The Needles Reduction Company, and appears to have been engaged in other enterprises acting through several closely allied corporations which he had organized for his own convenience, the assets of which were transferred from one to1 the other under his direction and control. When the notes matured, suit was brought by the bank and an attachment issued under and by virtue of which the stock of Mr. Blake in. The Pacific Coast Oil Company was levied upon. At this time the stock was held by a Mr. Tevis and Mr. Felton as collateral security for a loan to Blake upon which there was then due something like fifty-eight thousand dollars. Plaintiff was advised of the suit by Mr. Blake, and at once proceeded to San Francisco, and appears to have entered into an arrangement with him whereby his equity in this stock, over and above the amount necessary to discharge the notes held by Tevis and Felton, should be applied to the payment of other indebtedness of Blake to Woodbury, or parties whom he represented. Under this agreement he purchased the Tevis and Felton, notes, and thereby became the pledgee successor of Tevis and Felton of the stock pledged as collateral security for the payment of these notes. He also purchased The Needles Reduction Company notes of the bank. The amount paid for these purchases was the sum due on all the notes purchased. Thereafter he foreclosed the lien on the stock created by virtue of its pledge to secure the Tevis and Felton notes, buying in the stock at the sale for just the amount due upon such notes. He also had Blake enter an appearance in the suit brought by the bank, and obtained judgment against him upon which an execution was issued, and Blake’s equity in the attached stock sold under the execution, which he bought in for the sum of $10. His purpose in taking these steps, as he himself testifies in substance, was *7to secure a lien upon the stock and a claim upon the indorsers of the notes in suit. These several steps with respect to the disposition of the stock by plaintiff and Blake were taken without the knowledge or consent of Mr. Crosby. It appears that the value of the stock at the time of its sale under the lien created by the pledge, as well as under the execution, exceeded the amount due upon, the several notes purchased by Mr. Woodbury, and that he subsequently realized from the stock in the way of dividends and sale sums which in the aggregate greatly exceeded the amount due upon such notes. The defendant offered to prove at the trial that the money deposited with the bank as the proceeds of the loan represented by the notes of The Needles Reduction Company was drawn out and used by Mr. Blake for his personal use and that of another company, which hecontrolled, without any action of the board of Directors of The Needles Reduction Company. The action of the trial court in directing a verdict seems to have been based substantially upon the ground that the foreclosure of the pledge contract and the sale under execution were in all respects regular.
The testimony clearly established that Crosby was nothing more than a surety on the notes. Whether or not it also established that Blake was a principal, we shall not attempt to determine, for rea,sons which will be noticed later, but will assume for present purposes that it did. Where a creditor has in his hands or under his control property of the debtor which can be applied to the satisfaction of the debt, the surety for such debt has the right to have the property so applied, and any affirmative act of the creditor which prevents such application releases the surety' to the extent he is injured. This rule of law arises from the equities existing between the surety and the principal debtor. That is to say, when *8the creditor has the means in his h#nds belonging to the principal which is pledged for the payment of the debt, either by agreement between the principal and creditor, or by operation of law, the surety is entitled to be subrogated to the rights of the creditor upon paying the debt, and therefore any affirmative act of the creditor which prevents such subrogation releases the surety to' the extent he is thereby deprived of property which could be applied to the payment of a debt for which he is secondarily liable.— Guild v. Butler, 127 Mass. 386; Brandt on Suretyship (1st ed.), § 370; Phares v. Barbour, 49 Ill. 370; Kirkpatrick v. Howk, 80 Ill. 122; Jones on Pledges (2d ed.), §§513-514; Springer v. Toothaker, 43 Me. 381; Priest v. Watson, 75 Mo. 310; City of Maquoketa v. Willey, 35 Iowa 323; Mayhew v. Boyd, 5 Md. 102; Nelson v. Williams, 22 N. C. (2 Dev. & Bat.) 118.
The action of the court in directing a verdict for the plaintiff on the grounds assigned entirely ignored the rights and equities of the defendant. Prom the testimony the conclusion is irresistible that but for the interference of the plaintiff the defendant would never have been called upon to pay the notes. The value of the stock was ample to discharge the Tevis and Felton notes and those held by the bank. Plaintiff would certainly not have purchased these notes except he believed the stock was worth all he paid for it. He had no interest in either of these notes to protect, but made the purchase solely for the purpose of applying what he might realize from the stock over and above the amount necessary to discharge the Tevis and Felton notes upon other indebtedness of Blake. The latter certainly would not have permitted the stock to have been sacrificed or sold for a sum less than its reasonable value under a foreclosure of the pledge contract or on execution issued by the *9bank. The testimony of the defendant that Blake had agreed to indemnify him on account of the indorsement of the note was practically undisputed, so that if the property of Blake had been applied on the payment of the bank notes, he could not have maintained an action against the defendant for contribution. The fact that the foreclosure proceedings, as well as the sale under execution, were regular, was not alone the test, but the result which plaintiff and Blake intended to be, and in fact was, thereby accomplished, is pertinent. A lien on the stock was created by virtue of the attachment. The purpose of the sale was to divest this lien. The foreclosure and execution sale effected this result. The plaintiff and Blake had previously arranged what disposition of the stock should be made when released from the attachment lien. Plaintiff has received the benefit of this diversion, and he cannot also hold the defendant on obligations which would have been satisfied except for his action, unless it appears that for some reason other than that considered, he was under no obligation to apply the property to the payment of the notes in suit.
In our former opinion we held that he was under no such obligation, because the case had been argued by counsel for appellant solely upon the theory that the relationship between Blake and the defendant was that of principal and surety, and as the testimony received and offered failed to establish that plaintiff, at the time of the purchase and sale of the stock, had notice that Blake was a principal, the rule of law above referred to was not applicable. In other words, we held that as the stock attached belonged to Blake, and not to The Needles Reduction Company, that, in the absence of testimony received or offered which tended to prove that plaintiff had notice 'that the relationship of the parties to the notes was dif*10ferent from that exhibited by the notes themselves, and the case having been tried upon the theory that the relationship of principal and surety existed'as between Blake and the defendant, the rule of law announced did not defeat a recovery on the notes. We granted a rehearing because of the contention of counsel for defendant that the case was tried below with the acquiescence of all parties and the assumption by the court, that the question of notice to the plaintiff that Blake was the principal debtor was not an. issue or-essential to- the defense. The case was tried upon the issues made by the complaint, the first and third defenses interposed by the defendant, and the replication to that defense. The issues thus made as to the true relationship of the parties to the notes are not altogether clear. We mention this state of the pleadings so that in the event of another trial the-parties may re-form them in such manner as to clearly define and present the issues of fact in this respect, upon which they rely, and which they purpose to try. There can be no question from the testimony, and pleadings but that plaintiff was charged with notice that defendant’s liability on the notes was secondary. His complaint so stated, and the notes themselves exhibited that fact. While for many purposes his liability to the payee or holder was the same as that of a maker, this liability would not permit the holder who had knowledge that it was secondary to ignore his rights in the • disposition of property belonging to the principal which by operation of law was pledged for the payment of the notes. The liability of Blake and Crosby, as evidenced by the notes and as appears from the pleádings of the plaintiff, was the same; that is to say, the liability of both was secondary, and that the principal was The Needles Reduction Company. The stock belongéd to Blake. The important question, ordinarily, would *11therefore be, whether or not, at the time- plaintiff acquired the notes and stock, he had notice that Blake was the principal.- If he had, then the relationship of principal and surety was established between them, and plaintiff had knowledge of tlmt relationship. As we have already stated, the payee or holder of a note to secure which property has been pledged by the principal, cannot divert such property from the purpose for which it is pledgéd to the prejudice of a surety; but the liability of the payee or holder to the surety for such diversion would depend upon his knowledge, at the time of the diversion, of the relationship between the parties liable upon the notes, to secure which such property was pledged. Generally speaking, therefore, a-surety seeking to invoke this rule must plead and prove the facts which would entitle him to its application. — First Nat’l Bank v. Skidmore, 30 S. W. (Tex.) 564; Wilson v. Foote, 11 Met. 285; Harding v. Tifft, 75 N. Y. 461; Brandt on Suretyship (1st ed.), §17; Smith v. Sheldon, 35 Mich. 42.
In other words, a party to a noté desiring to interpose a defense based upon the ground that the relationship between another party to the note and himself is different from that exhibited by the note itself, must ordinarily plead and prove this relationship, as well as knowledge on the part of the payee or holder of its existence, for the obvious reason that such defense is affirmative in its character.
The third defense alleged that Blake was a principal and the defendant a surety. In this connection the facts were also pleaded with respect to the disposition of the oil company stock, upon which the defendant relied to establish a diversion which would release him from liability to the plaintiff upon the notes. No special agreement was stated in -this defense from which it could be inferred that Blake had *12agreed to indemnify the defendant, or if there was, that plaintiff had notice of such an arrangement. This, however, is not the crucial question; neither is it pleaded that plaintiff had notice that Blake was a principal. This plea, in so far as it purported to state a defense based upon the grounds that Blake was a principal and defendant only a surety, and that plaintiff had diverted property which should have been applied upon the notes, was not attacked for insufficiency. On the contrary, the plaintiff replied thereto without objection, thus apparently treating the defenses in this respect as sufficient in law. Evidence on the part of the defendant was received and offered, the evident purpose- of which was to prove that Blake was a principal, without objection on the part of the plaintiff that it was not responsive to the issues, or competent, because no sufficient defense was pleaded. At the close of the testimony the defendant requested a number of instructions, which were refused. Some of them purported to state the law on the subject of the rights of the defendant as a surety, growing out of the alleged wrongful diversion of the oil company stock by the plaintiff. On motion of counsel for plaintiff, the court instructed the jury to return a verdict for the plaintiff. The ground upon which this motion was -based is not stated. We must assume, however, that it was based upon the ground supporting the reasons which the court gave in sustaining the motion for the peremptory instruction. Prom this it clearly appears that the court did not regard the matter of the relationship of the parties to the notes as of any importance, and, further, that counsel for the plaintiff did not regard that question as of any material moment, but relied solely on the proposition, that the sale and disposition of the stock, being in all respects regular, the defendant had no cause of complaint. This, as we have seen, was not *13the test to apply in determining' the liability of the defendant to the plaintiff, and that the sale of the stock, although in all respects regular, did not relieve the plaintiff from responsibility for the diversion of the stock, but that the respective rights of the parties depended entirely upon other questions which neither the court nor counsel for the plaintiff considered as of any vital importance. We must, therefore, assume that the instructions requested on the part of the defendant, which undertook to define and state the duties of the holder of notes to a surety when it comes to the disposition of property pledged by the principal for their payment, were not refused because the defense or evidence did not justify the submission of such question to the jury. A judgment may be affirmed upon a ground other than that which influenced the trial court, and should not be reversed merely because it is based upon a wrong reason. If, however, it appears that a wrong reason adopted by the trial court prevented the defeated party from properly presenting his case, or prejudiced his rights, then the error of the court should be corrected on review. Appellate courts should be careful to prevent injustice resulting from the affirmance of a judgment upon a question not presented to the trial court, or which it ignored, and which might have been avoided had attention been directed to it. A question raised for the first time on appeal is not favored. Hence, an appellate court should not ordinarily affirm a judgment which is erroneous, as tested by the reasons assigned for its rendition by the trial court, upon a ground involving a question of pleading or fact not fully developed at the trial, and to which attention of'neither court nor counsel was called, when tire affirmance might result in a miscarriage of justice. —Baker v. Kaiser, 61 Fed. 303.
*14Tested by these considerations, we do not think we would be justified in affirming the judgment upon the ground that the record does not show that plaintiff had notice of the alleged fact that Blake was a principal. The court directed a verdict upon grounds wholly untenable; whereas, had it but considered those which were vital, and based'its ruling on them, the defendant might have been afforded an opportunity to either amend his pleadings, if defective, or supply omissions in testimony, which defects and omissions are now urged as grounds upon which the successful party relies to support a judgment which cannot be sustained upon those assigned by the trial court.
We are confirmed in our conclusion that the question of want of notice to the plaintiff that Blake was a principal was not raised below, from an examination of the briefs on the part of appellee. From these briefs it would appear that the question of notice, to which the attention of this court was directed, related to the proposition that plaintiff did not have notice of the arrangement between Blake and Crosby, that the former would indemnify him against loss on account of his indorsement of the notes. Notice to the plaintiff of this arrangement at the time he purchased the stock would undoubtedly have required him to malee no disposition thereof to the prejudice of the defendant, but the rights of Crosby under this arrangement would attach by virtue of the special agreement, while those resulting from the relationship of principal and surety would attach by operation of law, so that the liability of plaintiff in the one case would depend upon notice of the special agreement, and in the other upon notice that Blake was a principal. On behalf of appellee it is contended that the testimony was. not sufficient to establish facts from which it cpuld be inferred that Blake was a prin*15eipal on the notes. We are satisfied, for the reasons already given, that this question was not raised below, and we shall not, therefore, attempt to determine that proposition at this time.
It was-also alleged in the third defense that in the suit of the bank real and personal property of The Needles Reduction Company was levied upon under writs of attachment issued, the value of which was sufficient.to discharge.the whole, or at least a great part, of the indebtedness evidenced by the notes sued upon, had due diligence been used with respect to such property; that judgment was thereafter rendered in such action in favor of the plaintiff, but that he wholly failed and neglected to issue any execution thereon against the property of the company attached, whereby such property was wasted and lost. The defendant knew this suit was begun, but never requested any steps to be taken by either of the par.ties interested in the judgment for the purpose of applying the property attached upon the judgment. It appears, or at least it is claimed by the defendant, that this property has been wasted and destroyed. At the trial a witness on’the part of defendant was asked to state the value of this property. An objection to this question was sustained. Counsel for defendant contend that plaintiff was bound to exercise diligence in applying the attached property'upon the judgment against The Needles Reduction Company, and for this reason it was error for the court not to allow the value of such property to be shown, because, to the extent of such value, the defendant was released from liability on the notes. It is affirmative acts of the creditor with respect to property holden for the debt of the principal which destroys the security, and not mere inaction of the creditor, which is nothing more than an omission to enforce collection from the property pledged of which the surety may complain. *16—1 Story’s Eq. Jur. (12th ed.), §§ 325, 501; 2 Daniels’ Neg. Instru. (5th ed.), §1311; Colebrooke’s Collateral Securities, §241; Schroppell v. Shaw, 3 N. Y. 446; City of Maquoketa v. Willey, 35 Iowa 323; Kindt’s Appeal, 102 Pa. St. 441.
This general rule, however, is not applicable to exceptional cases, as where the surety has requested the creditor to proceed, • or where the circumstances are such that the law would impose upon the creditor the obligation to take steps to collect the debt out of the property of the debtor.
The reason for the rule applicable to the case at bar, is, that the surety, upon payment of the debt of his principal, shall be subrogated to- the rights of the creditor in all securities pledged by the principal debtor as security for the debt, for the payment of which he is surety, and hence, unless the creditor has done some affirmative act, by which this right is destroyed, the surety has not been injured. Mere omission on the part-of Woodbury to issue execution on the judgment and sell the property of The Needles' Reduction Company which had been attached, in the absence of a request by the defendant to do so, is not an act of which he can complain. It was his duty to discharge the notes, and take over to" himself the rights of the. Needles Company in the property which the plaintiff acquired by virtue of the attachment and judgment. No affirmative act on the part of the plaintiff has deprived him of the exercise of this right. He knew of the suit and the steps taken. It was Ms business to judge of the danger to be apprehended from delay in not subjecting the attached property to the payment of the judgment, and if that property has been lost, it has been caused by his own negligence in failing to protect his rights and not by the omission of any duty which the plaintiff owed him.
*17Rehearing en banc denied July 2, 1906.
It is also urged on behalf of appellant that, because plaintiff held the stock and realized from the sale thereof and dividends thereon sufficient to discharge the notes, after answer in the case was filed, whereby he was fully advised of Crosby’s rights, that, from the time of 'filing such answer, he was charged with notice of such rights. No authority is cited to support this proposition. The liability of the plaintiff must be determined from his knowledge of the rights of the parties at the time he acquired the notes and stock, and was not affected or enlarged'by knowledge subsequently acquired respecting these matters.
On behalf of the plaintiff it is contended that Blake was not the owner of the Pacific Oil Company stock at the time it was acquired by the plaintiff. Both Blake and the plaintiff treated it as belonging to the former. It was through an arrangement entered into bétween them that the plaintiff finally became the owner of, or controlled, this stock. He obtained title thereto through Blake. He has received the dividends thereon, and the proceeds arising from a sale thereof. He credited Blake with these proceeds upon indebtedness due him or others whom he represented. In such circumstances, he is certainly not in a position to raise the question that the stock was the property of some one other than Blake.
The former opinion is withdrawn, the judgment of the district court reversed, and the cause remanded for a new trial. Reversed and remanded.
Mr. Justice Steele dissenting.
[Note. — The original opinion in this case was handed down prior to the reorganization of the supreme court on April 5, 1906, in which opinion Mr. Justice Steele did not participate.]