From the application for preference of appellant in this case it appears that one J. A. Givens was duly appointed treasurer of the Nampa & Meridian Irrigation District about June 2, 1913; that on June 2, 1913, the American Surety Company became the surety of Givens for the faithful performance of his duties as treasurer of such district that he would account for, pay over and deliver to the person entitled to receive the same, all moneys that came into his hands as such treasurer; that on and after June 2, 1913, and prior to September 27,1913, moneys of such district came into the hands of the said Givens as treasurer of said district, and were deposited by him in the Bank of Nampa, Limited, on general deposit to the credit of such district; that during such time certain sums were withdrawn from time to time from the funds so deposited, leaving a balance so on deposit September 27, 1913, of $1,046.64; that Givens was the cashier of the Bank of Nampa, Limited, and that all such deposits and withdrawals were made with full knowledge on the part of such bank that such moneys were the property of the Nampa & Meridian Irrigation District; that on or about September 27,1913, the Bank of Nampa, Limited, closed its doors and suspended payment, at which time, and ever since, such bank has been and now is insolvent; that on the application of the State Bank Commissioner of Idaho one E. Smallwood was appointed receiver of such bank on October 13, 1913, and ever since has been and now is such receiver, and as such receiver there came into his hands the said sum of $1,046.64, *170money of such district; that on January 17, 1914, appellant, as such surety, paid to the said district the sum of $1,046.64, and such district assigned all its interests therein to appellant, including the right to collect the same, and including the right of appellant to be subrogated to all the rights of said district; that on January 28, 1914, appellant demanded from such receiver the said sum of $1,046.64, and he refused to pay the same; that such receiver threatens and intends to pay such sum to the creditors of such bank. Then follows the prayer that such sum be adjudged the property of appellant, and not a part of the estate of such bank, and that such receiver be directed to pay the same to appellant.
To this application the receiver demurred generally upon the ground that said application failed to state facts sufficient to constitute a cause of action or preference against the Bank of Nampa or the receiver. This demurrer was by the court sustained, and the appellant declining to plead further, judgment was rendered dismissing such application. This is an appeal from the judgment.
There is, as will be observed from the foregoing statement, but one. important question presented for our consideration and determination, namely: Did the deposit of the moneys of the Nampa & Meridian Irrigation District by Givens, treasurer of such district, constitute a special deposit, and therefore a preferred claim against the estate of the Bank of Nampa?
We think it will be conceded at the outset that irrigation districts organized under the laws of this state are public corporations; that the officers of such irrigation districts are elected by the electors of the district and are public officers. As such they are required to qualify and furnish an official bond for the faithful performance of the duties of their office in accordance with the law providing for the creation of irrigation districts and defining the power of such districts and the duties of the officers of those districts. Since all officers of an irrigation district are public officers, moneys paid to the treasurer of such district would constitute a payment to and receipt by a public officer who would be the custo*171dian of public moneys. (Fallbrook Irr. Dist. v. Bradley, 164 U. S. 112, 17 Sup. Ct. 56, 41 L. ed. 369; In re Madera Irr. Dist., 92 Cal. 296, 27 Am. St. 106, 28 Pac. 272, 675, 14 L. R. A. 755; People v. Selma Irr. Dist., 98 Cal. 206, 32 Pac. 1047; Hertle v. Ball, 9 Ida. 193, 72 Pac. 953; City of Nampa v. Nampa etc. Irr. Dist., 19 Ida. 779, 115 Pac. 979; Pioneer Irr. Dist. v. Walker, 20 Ida. 605, 119 Pac. 304; Little Willow Irr. Dist. v. Haynes, 24 Ida. 317, 133 Pac. 905; Indian Cove Irr. Dist. v. Prideaux, 25 Ida. 112, Ann. Cas. 1916A, 1218, 136 Pac. 618; People v. Hamilton, 3 Cal. Unrep. 825, 32 Pac. 526; People v. Wilson, 117 Cal. 242, 49 Pac. 135.)
Sec. 6977, Rev. Codes, provides: “The phrase ‘public moneys,’ as used in the two preceding sections, includes all bonds and evidences of indebtedness, and all moneys belonging to the state, or any city, county, town, or district therein, and all moneys, bonds, and evidences of indebtedness received or held by state, county, district, city, or town officers in their official capacity.” Sec. 6975, Rev. Codes, provides: “Each officer of this state, or of any county, city, town, or district of this state, and every other person charged with the receipt, safekeeping, transfer, or disbursement of public moneys, who either: .... 4. Deposits the same or any portion thereof in any bank, or with any banker or other person, otherwise than on special deposit, or as otherwise authorized by law; .... Is punishable by imprisonment in the state prison for not less than one nor more than ten years, and is disqualified from holding any office in this state. ” Sec. 6976, Rev. Codes, provides: “Every officer charged with the receipt, safekeeping, or disbursement of public moneys, who neglects or fails to keep and pay over the same in the manner prescribed by law, is guilty of felony. ’ ’
It is admitted by counsel for respondent, in their brief, that if the law were the same now as it was during the time the Revised Statutes of 1887 were in effect, then the contention of appellant that moneys belonging to an irrigation district in the hands of the treasurer of such district are public moneys which cannot lawfully be placed upon general deposit in any bank or with any banker or other person, might be of some *172merit. But they insist that the law has been completely changed by the acts of 1905 and thereafter, which acts are known as the depository laws, and which provide for the deposit in banks of state and county funds; and that while under the Bevised Statutes, supra, state and county treasurers were required to keep state and county funds, respectively, in the vaults of the state and county, and were not permitted to place the same upon general deposit or to receive interest upon these funds, yet it is now made not only legal for these officials to deposit public moneys upon general deposit in various banks of the state and receive interest therefor, but it is made their express duty to do so, providing the banking institutions designated by law as state and county depositories furnish bonds in such penal sums as the law provides. They further contend that, by reason of the changes referred to in the policy of the law of this state in this respect, that is, by the enactment of the state and county depository laws, subdivision 4 of sec. 6975, supra, has been absolutely repealed.
We are, however, not in accord with this latter contention. That it is now by law made the duty of state and county treasurers to deposit public moneys coming into their hands as such treasurers on general deposit in certain banking institutions, upon compliance by such institutions with the provisions of the statutes governing such deposits, may be conceded. Yet a violation of those statutes by state or county treasurers, in our opinion, would render them amenable to the provisions of sec. 6975, Bev. Codes. In our view, subdivision 4 of that section was not repealed by the enactment of the state and county depository laws. It is still in force, and applicable in case public moneys should be deposited by state or county treasurers in violation of the law authorizing the deposit of public moneys.
Upon an examination of the state and county depository laws heretofore referred to it will be found that no reference is made therein to the depositing of district, city or village funds by the treasurers of such districts, cities or villages. The legislature in the enactment of those laws made no at*173tempt to change the law governing the deposits of such funds. It therefore becomes important to determine whether or not an irrigation district is a district within the meaning of sec. 6977, supra.
It is insisted by counsel for respondent that this section is the same as section 6977 of the Revised Statutes of 1887, and that at the date of the first enactment of this section, irrigation districts’ were unheard of in this state. This identical question was presented to the United States circuit court of appeals of this circuit, in the case of Continental & C. T. & S. Bank v. Corey Bros. Const. Co., 208 Fed. 976, 126 C. C. A. 64, wherein it was contended that section 5110, Idaho Revised Codes, was merely the adoption of section 5125 of our Revised Statutes of 1887, and that at the time of the adoption of such section the legislature could not have had in contemplation the granting of the lien upon any irrigation system constructed under what is known as the Carey Act, enacted by Congress and approved August 4, 1894, and the amendments thereto approved, respectively, June 11,1896, and March 3, 1901, because systems constructed under such acts were unknown at that, time and could not have been in contemplation at the time of the adoption of section 5125 of our Revised Statutes. But that court said that this question had been met and decided by the supreme court of this state in Nelson Bennett Co. v. Twin Falls Land etc. Co., 14 Ida. 5, 93 Pac. 789, and Hill v. Twin Falls etc. Water Co., 22 Ida. 274, 125 Pac. 204, wherein this court held that one who contracts to construct canals and works for the irrigation of arid lands under the Carey Act is entitled to the benefit of the lien laws to secure payment to him for such work to the full extent of the title, interests, rights and claims of the company having the construction contract with the state, which decisions the United States circuit court felt bound to follow. (See, also, Smith v. Faris-Kesl Const. Co., Ltd., 27 Ida. 407, 150 Pac. 25.) We think that the principle announced in the foregoing decisions has equal application to the case at bar, and that, by the adoption of sec. 6977, Rev. Stats., by the legislature in 1909 as *174sec. 6977, Rev. Codes, the same became the law of this state, and applies to irrigation districts.
This court held in the ease of Hertle v. Ball, 9 Ida. 193, 72 Pac. 953, that the treasurer of an irrigation district is a public officer of the state. Subdivision 4 of sec. 6975, Rev. Codes, makes it a felony for a public officer to deposit public moneys otherwise than on special deposit, or as otherwise authorized by law. And since there is no provision of law which authorizes the treasurer of an irrigation district to deposit the moneys of the district except on special deposit, the cases of State v. Thum, 6 Ida. 323, 55 Pac. 858, Bellevue State Bank v. Coffin, 22 Ida. 210, 125 Pac. 816, and First Nat. Bank v. C. Bunting & Co., 7 Ida. 27, 59 Pac. 929, 1106, where this court held that public moneys deposited by a public officer in a bank beeomes’a trust fund and not part of the estate of the bank, and in case of insolvency of the bank its receiver must treat such fund as the property of the true owner and not of the bank, in our opinion, are in point and control in this case.
We do not think that it can be seriously contended that the statutory provisions for depositing state moneys found in sections 127-136, Rev. Codes, as amended, or the provisions for depositing county moneys, found in secs. 1991-2022, Rev. Codes, as amended, have any application to the method of depositing irrigation district money. Nor do we think it will be contended, under the facts in this ease, that sec. 2261, Rev. Codes, governing the deposit of municipal funds, will apply to the ease at bar.
The provisions of the statutes heretofore cited are all of the provisions to which our attention has been directed that have been enacted by the legislature to regulate the deposit of public funds, safeguarding them by penal bonds. The legislature has failed to make any provision for the deposit of irrigation district funds, other than to prohibit by sec. 6975, Rev. Codes (subd. 4), the deposit by the treasurer of such district of the district’s funds in any bank, or with any banker or other person, otherwise' than on special deposit. Therefore the deposit made by Givens as treasurer of the Nampa & Meridian *175Irrigation District of the funds of the district in the Bank of Nampa, Limited, was a special deposit. And it became the duty of the receiver of that bank to treat such fund as the property of the «irrigation district and not of the bank.
The Nampa & Meridian Irrigation District had a right to recover from the Bank of Nampa, Limited, its moneys unlawfully placed on general deposit in the bank by its treasurer, irrespective of the fact that appellant herein had theretofore furnished a surety bond guaranteeing the faithful performance by the treasurer of the district of all of his official duties. That being true, we think it follows that under the subrogation agreement entered into between appellant and the Nampa & Meridian Irrigation District and made a part of the application for preference in this case, appellant is subrogated to all of the rights of the irrigation district, and may maintain this action to recover the funds of said district unlawfully deposited in the bank.
In the case of Aetna Life Ins. Co. v. Middleport, 124 U. S. 534, 548, 8 Sup. Ct. 625, 31 L. ed. 537, 542, the court said: “The doctrine of subrogation is derived from the civil law, and ‘it is said to be a legal fiction by force of which an obligation extinguished by a payment made by a third person is treated as still subsisting for the benefit of this third person, so that by means of it one creditor is substituted to the rights, remedies and securities of another.....It takes place for the benefit of a person who, being himself a creditor, pays another creditor whose debt is preferred to his by reason of privileges or mortgages, being obliged to make the payment, either as standing in the situation of a surety, or that he may remove a prior encumbrance from the property on which he relies to secure his payment. ’ ’ ’ And in the ease of Leavitt v. Canadian Pac. Ry. Co., 90 Me. 153, 37 Atl. 886, 38 L. R. A. 152, the court said: “In accordance with these equitable principles, a surety who has been compelled to pay a debt for which another is primarily liable succeeds to all the rights which the creditor had of enforcing the liability of the original debtor. ’ ’ To the same effect is the ease of Wilson v. Wilson, 6 Ida. 597, 57 Pac. 708, wherein this court said: “ ‘Sub*176rogation,’ as defined by thé leading text-writers and lexicographers, is the substitution of one person in the place of another as a creditor, the new creditor succeeding to the rights of the former; the mode by which a third person who pays a creditor succeeds to his rights against the debtor. Under that definition, when one person, being under obligation to do so, or is interested in so doing, pays the debts of another, he may be subrogated to all the rights, securities and remedies of the creditor.”
The appellant in this ease having paid to the Nampa & Meridian Irrigation District the public moneys of that district which were wrongfully and unlawfully placed upon general deposit in the Bank of Nampa, Limited, of which the bank had full knowledge, under the agreement before mentioned, its relationship to the bank became the same as that of the irrigation district.
Counsel for respondent in their brief have very ably submitted and argued additional reasons why the demurrer should be sustained to the application upon the ground that it does not state facts sufficient to entitle appellant to recover in this action. We have carefully examined and considered the points they make, but do not deem it necessary to discuss them in this opinion in view of the conclusions we have reached.
From what has been said it follows that the trial, court erred in sustaining respondent’s demurrer to appellant’s application. The judgment of the trial court must be reversed and the cause remanded, with instructions to the trial court to overrule the demurrer and permit respondent to answer, and it is so ordered. Costs are awarded to appellant.
Sullivan, C. J., and Morgan, J., concur.