Plaintiff brings this action to foreclose a mortgage on a half section of land in Brown county. The land belonged) to defendant Treeby. During the summer of 1921, Treeby contracted with defendant lumber company for material with which to build a bam on the said land. The cost of this material was $1,656.65. The material was delivered and actual visible construction of the barn was commenced on or before the 14th day of August, 1921. When the contract for this material was made, it was understood between defendant and Treeby that a part at least of the bill for this material was to be paid in cash, but for some reason this was not done.
■Ait the time Treeby purchased the above material, he was negotiating with plaintiff for a loan to be secured by a mortgage on the said half section of land. These negotiations resulted in a loan of some $20,000. The mortgage was dated August 24, acknowledged August 29, filed for record October 14, but the money was not paid until November 9, 1921. At the time Treeby purchased the above building material, he was already owing defendant a bill of something over $800 for which defendant appears to have had no lien or other security. After Treeby received the *200money on the loan, he paid the lumber company $1,000 but he gave no directions as to which of the two bills the money was to be applied upon, and the lumber company credited it first upon the older of the two accounts. Later on another payment was made. This reduced the balance due on the material that 'was used in building the barn to $i,395.05, and within the time allowed by law for filing liens the lumber company filed' a mechanic’s lien for this amount. At and for some time prior to the making of the said loan, the said half section of land was subject to two mortgages — one for $3,000 and the other for $6,500. Part of plaintiff’s loan was used to satisfy these two’ mortgages. The quarter section on which the said barn was built, and which was occupied by other farm buildings, constituted the homestead of Treeby and his family. The evidence shows that this quarter section with the improvements thereon was worth not less than $7,200.
Two questions are submitted for the determination of the court: First, did the lumber company acquire a mechanic’s lien on the Treeby homestead; and, second, if such lien was acquired, was it superior in right to plaintiff’s mortgage?
Under the provisions of section 1644, R. C., as amended by chapter 280, Laws 1921, a mechanic’s lien may attach to a homestead to the extent that the value of the homestead exceeds $5,000.' In this case the uncontradictedi evidence shows that the value of the homestead did exceed $5,000. Whatever it may have been, it was sufficient to' support the lien and gave the lienor the right to pay the owner of the homestead $5,000, to pay off prior incumbrances, if any — in this the two mortgages amounting to $9,500 — and to' apply the balance of the excess, if any, to' its lien. The fact that the value of the property in this case may not have been sufficient to pay the incumbrances after deducting the value of the homestead is not material. The right to the lien existed, and it is optional with the lienor whether he will pay off the prior incumbrances and avail himself of his lien.
The next question to be determined is the extent of defendant’s lien. It is conceded! that the $1,000 that was paid to defendant on the 14th of November was a part of the money furnished by plaintiff on the loan, and it is contended: First, that defendant knew that it was the intention and desire of Treeby that *201this payment be applied on the debt for the material that was used in building the 'barn; and, second, that such desire was known to defendant when the money was-paid. The evidence fails to substantiate this claim. The money had been paid to Treeby by plaintiff, but without any directions as to the use that was to be made of it, and it was paid to defendant by Treeby without any directions as to any particular account on which it was to- be applied. Under these circumstances, defendant had the right to apply the $1,000 toward the extinction of any obligation, performance of which was due to defendant from Treeby at that time. Section 757, Code 1919. The result is that defendant was entitled to a lien on the homestead for $1,395.05. This lien, however, was inferior to the lien of the two mortgages above mentioned aggregating $9,500. These two mortgages were paid and extinguished with money received from defendant Treeby on the loan, and plaintiff contends that as a matter of equity it should be given precedence over the mechanic’s lien. The facts and circumstances shown do not raise any equities in favor of plaintiff. It was not in position where it was obliged to pay off a superior lien in order to protect an existing lien of its own. It had notice of the existence of the said mortgages before it made the loan, and it is charged with notice that the building material was being delivered on the premises and the barn was being constructed before it parted with its money to Treeby. If it was its intention or desire to have existing liens and incumbrances paid with the money advanced by it, it was its duty to- see that the money was applied to that purpose. 'Not having done this, it is in the position of a mere volunteer who advanced money to Treeby and left it optional with him as to the use that would be made of it by him.
Lastly, the plaintiff invokes the doctrine of subrogation. In support of this contention plaintiff quotes the law from 37 Cyc. 443, as follows:
“A person who, in order to protect his own interest or rights in property, is compelled to pay an existing obligation against the same, such as a mortgage or other lien, is entitled to be subrogated to the rights of the creditor whose debt he paid, and to the lien of the incumbrance discharged; and he thereby becomes an equitable assignee and may keep the mortgage alive and enforce the lien for his own' benefit.”
*202This, we believe, is a correct statement of the law, but it is not applicable to the facts in this case. As above stated, plaintiff was not in position where, in order to protect its own interests, it was compelled to pay off existing obligations. Heegaard v. Kopka (N. D.), 212 N. W. 440. It was entirely on the outside, and voluntarily paid its money to Treeby without taking the precaution to have prior encumbrances extinguished.
This case will be remanded to the circuit court, with directions to so. modify the judgment appealed from as to establish the amount of defendant’s mechanic’s lien in harmony with this opinion, and declare the same superior to the mortgage lien of plaintiff. Costs on this appeal to be taxed- by appellant.
CAiMHBRLL, P. J., and .GATES, SHERWOOD, and BURCH, JJ, concur.