This is a proceeding in mandamus to compel the county treasurer of Richland county to credit a collection made by him of interest and penalty collected to the particular drain fund for which such interest and penalty and special assessment was paid. Viking-township, the relator, was assessed $2,641 for special benefits received by highways within its limits from the construction of Viking drain Ho. 14. Upon payment thereof after delinquency, it also paid in addition thereto the sum of $185 as interest and penalty upon such special assessment, which sum was so received by the county treasurer of Richland county. The total payment was then divided, and said offi*179cial, acting under the orders of the county commissioners, credited said $185 to a so-called county courthouse fund belonging to the county, instead of its being credited to and placed as a part of the drain fund of Viking drain. Relator seeks to compel the county treasurer to credit, as a part of said drain fund, this amount so collected as interest and penalty. From an order of the lower court so directing, the county treasurer appeals.
On the merits, appellant’s contentions are summarized by him to be: “First, that there was no law authorizing the collection of either interest or penalty at the time of this collection, it being prior to the enactment of chap. 125 of the Session Laws of 1911; and, second, that under the law this interest and penalty collected belonged to the county.” To the first of these propositions we unqualifiedly agree. We have held in Hackney v. Elliott, 23 N. D. 373, 137 N. W. 433, that on special assessments levied for drainage purposes prior to the 1911 statute, no interest and penalty can legally be collected. Until the enactment of the 1911 statute, no authority existed for the collection of interest and penalty upon drainage assessments. We may here remark that cities have always had statutory authority for the collection of interest and penalty on special assessments for city purposes, so this holding concerning interest and penalty on drain assessments is not to be understood as applying to the collection of special assessments for cities. Rev. Codes 1905, Sec. 2807; Fargo v. Ross, 11 N. D. 369, 92 N. W. 449; Pine Tree Lumber Co. v. Fargo, 12 N. D. 360, 96 N. W. 357; Red River Valley Nat. Bank v. Fargo, 14 N. D. 88, 103 N. W. 390.
The question then is, Conceding that the amount so paid for and as interest and penalty on delinquent special assessments could not have been collected if it had not been voluntarily paid for such purposes, does it belong to the county or to the said drain fund ? The statute, § 1832, Rev. Codes 1905, as amended by the Session Laws of 1907, at page 127, concerning the collection of drainage assessments, provides: “The drain taxes shall be collected by the county treasurer, and all moneys so collected shall be credited to the drain fund to which they belong, and the county treasurer shall be the treasurer of such drain: funds.” The excess part of this special assessment collection then was so collected by the treasurer of this drain fund, the county treasurer *180by statute being ex officio collector of said fund. Had the collection of interest and penalty been authorized by statute, then by virtue thereof it should “be credited to the drain fund” to which it belonged. And unless some statute operates to transfer the right to such excess collected as interest and penalty to the county, it must on general principles follow the special assessment (37 Cyc. 1594) ; and under this statute directing the credit of “all moneys so collected” it must be regarded as a part of the fund for which it was paid and collected. Besides, a further reason exists, being that the taxpayer, relator, still has a right concerning the ajjplication of the money paid, it having been voluntarily paid and received as trust funds to be applied to the payment of the expenses of the drainage construction, to the extent at least to which the township property may have been heretofore, or may have to be hereafter, assessed to fully meet such cost of drain construction. As is stated in Red River Valley Hat. Bank v. Bargo, 14 N. D. 88, on page, 93, 103 N. W. 390, concerning city assessments analogous to drainage assessments: “Every dollar thereafter coming into that fund up to the amount required to redeem each of these warrants became impressed with a trust in favor of the holder of each warrant, and the city was the trustee.” In this case the county undoubtedly is the trustee. A diversion by a city of moneys collected by it to meet special assessment paving warrants is a “violation of a trust, rendering the city liable.” Pine Tree Lumber Co. v. Fargo, 12 N. D. 360, at page 377, 96 N. W. 357, and abundant authority there cited. “If overpayments upon the assessments have been made, the party who has made such overpayments is entitled to have them applied to the payment of in-stalments to become due in the future.” Page & J. Taxation by Assessment, § 1094, citing Fall Creek & W. Twp. G. R. Co. v. Wallace, 39 Ind. 435; Re Rust, 24 Hun, 229; Cincinnati v. James, 55 Ohio St. 180, 44 N. E. 925; and Cincinnati v. Manss, 54 Ohio St. 257, 43 H. E. 687. We think the law is settled that a special assessment collection cannot be diverted to other uses.
But appellants contend that § 1575, Rev. Codes 1905, operates to transfer the right to this penalty and interest collection to the county. The statute reads: “All penalty and interest collected on taxes shall belong to the county and become a part of the general fund, or such other fund as the county commissioners may direct; except the penalty *181and interest collected on special assessments due to cities, and all such penalties and interest shall he paid to the city thereunto entitled.” We have held in Hackney v. Elliott, supra, that this and other statutes concerning taxes do not apply to special assessments for drainage purposes, and that interest and penalty on drain assessments as heretofore stated cannot he legally collected. If the law does not contemplate or authorize the collection of interest and penalty on drain assessments, most certainly § 1575 of the Code cannot authorize or be construed as directing that such interest and penalty collected without authority of law shall belong to the county and become a part of the general fund, or be subject to the control of the county commissioners. This statutory provision has reference only to taxes, and has no application to special assessments or any payments made as a part of special assessments or collected under color of special assessment provisions. Jones & P. Taxation by Assessment, § 475, and § 1575 was not repealed by chap. 93, Sess. Laws, 1907. This collection is no part of a tax, but rather is part of a special assessment and is left in the fund into which it was voluntarily paid and in which relator is still interested in its application.
But there is another all-sufficient reason why the appellant, the county- treasurer, should not prevail. Appellant cannot he heard to urge any irregularity or illegality in this collection as against the respondent so interested in the Yiking township drain fund. Acting as the treasurer of such drain fund, the county treasurer has collected this $185 as interest and penalty and as a part of a total collection made for this particular drain fund of which he is, by virtue of his office, custodian, with the county also a trustee for the fund. He should not he heard to question the legality of his own act in collecting the same. It must, so far as distribution of public funds is concerned, be regarded as drain funds voluntarily paid and legally collected for such purpose. The county having no interest therein, the only duty of its officer and the treasurer of this fund is to credit the amount thereof to this drain fund, and “it is wholly immaterial that the tax collected by him may have been unconstitutional or otherwise illegal and void; or that it was improperly collected as under the authority of a defective assessment or warrant or even without any warrant at all. . . . He cannot impeach his own acts, or question the right of the state or other political. *182division at whose instance the tax was collected to receive the same. Having accepted the money as collected, he is estopped from denying the validity of the tax. Though the taxpayer might properly refuse to pay the tax, and though the collector might be justified in refusing to collect it, if the tax is actually paid into the collector’s hands the trust attaches and the right of the taxing authorities to insist upon payment over is perfect.” 21 Am. &• Eng. Enc. Law, 801, 802. “Such a suit [against a collector for public moneys collected as taxes] the collector can defend only on such grounds as would constitute a defense to a like suit as between other parties who stand in the relation of principal and agent. It would be a suit for money received by the collector for the use of the public; and he would not be permitted to rely on technical objections which might be made to the right of the public to the money. If he receives the money to the use of the public, he should account for it. And it is immaterial that those who have paid it might successfully have resisted the collection from them.” 2 Cooley, Taxn. 1324. And by statute it is for this collection as a part of a drain fund that he must account. “It is the duty of a tax collector to pay over the money actually received by him in the form of taxes, notwithstanding the. tax may be illegal or there may be defects in the levy, assessment, or tax warrant. And this he must do punctually at the time or, times required by law.” 31 Cyc. 1206. And such is already the declared law of this state. Red River Valley Nat. Bank v. Fargo, 14 N. D. 88, 103 N. W. 390, from page 94, of which we quote: “The money paid for these special assessments was paid to and received by the city for the sole purpose of paying for this paving. It is too clear for argument that the city cannot be heard to say that it is under no obligation to pay the money so received to those for whose benefit it was paid, because those who paid it could not have been compelled to do so.” This applies equally to the county and its officer, appellant. There is no distinction in principle between the defense urged by the city against the payment of the paving warrants, to meet which special assessments were levied and paid as in that case, from the defense here urged by appellant. His plain duty is that “all moneys so collected shall be credited to the drain fund to which they belong;” and he, as “the treasurer of such drain fund,” is the party directed by statute to make such credit, and that without questioning the right of the drain dis*183trict to make the collection; he, having made the collection and received the money as a part of said fund, must credit it to that fund. And, as heretofore stated, the county having no right to the money so collected for such purposes, the provisions of § 1575 not applying, the county commissioners are 'without authority to order a credit of said moneys tc be made to another fund in disregard of § 1832, as amended by the Session Laws of 1907, above quoted.
We should state here that the 7 per cent interest exacted in Hackney v. Elliott, 23 N. D. 373, 137 N. W. 433, was under the principle of compelling equity of one seeking equity. The county had there sold the assessed property at a tax sale and received the purchaser’s money thereon. The sale being adjudged illegal for reasons stated, the county was obliged by statute (§ 1705, Eev. Codes 1905) to reimburse the purchaser with 7 per cent interest from date of sale. Hence, before granting relief from such sale, such repayment with interest should be compelled. But in the absence of a sale, or prior to a sale, no interest can be collected on special drain assessments prior to collections made under the 1911 statute explicitly giving such right.
The appellant has attempted to urge that Eichland county is a proper and necessary party to this proceeding, and that because of the nonjoinder of the county therein there is such a defect of parties as will preclude a judgment on the merits involved. We note that issue was joined by answer to the affidavit and alternative writ after a demurrer had been interposed and sustained and amendments thereafter made to the affidavit and writ, and that the defendant has not demurred because of a defect of parties defendant. And he has answered and joined issue on the merits and thereafter tried such issues. He has therefore waived any defect in parties defendant, granting there may have been such a defect. Sections 6854 & 6858, Rev. Codes 1905; Ross v. Paige, 11 N. D. 458, 92 N. W. 822; Olson v. Shirley, 12 N. D. 106, 96 N. W. 297; Van Gordon v. Goldamer, 16 N. D. 323, 113 N. W. 609, at page 331.
If authority for the remedy of mandamus is necessary, see 26 Cyc. 33,4: “Upon the collection of taxes, mandamus will lie to compel a proper apportionment or division thereof among the municipalities and officers lawfully entitled thereto.” Such only is the relief here sought, in effect a tax apportionment to a particular fund to the credit *184of the lesser municipality for which the county, through its treasurer, acts as the collecting municipality. “Since mandamus lies to compel the performance of a clear legal and nondiscretionary duty, if the public corporation or officer which is bound to perform such duty refuses or neglects so to do, it follows that where the facts are conceded or established, which show the existence of the legal duty, the absence of -the power of exercising a discretion in the matter and the failure or omission of the corporation or officer thereof to perform the duty, mandamus will lie;” citing instances of its exercise. Page & J. Taxation by Assessment, § 1469. The duty is here plain, the act nondis-eretionary, the facts not in controversy, the refusal conceded but sought to be justified by an erroneous construction of law, the right of relator to recover the tax doubtful and waived with no adequate, specific relief; mandamus as relief is ample, full, adequate, speedy, and the relief necessary. It is the proper remedy.
As to the extent of the relief to which relator is entitled, the writ properly covered all payments similar to that made by relator, which were paid as a part of, or as interest and penalty upon, special assessments to create the drainage fund for Viking Drain Ho. 14. “The right of a taxpayer to institute an action to enjoin municipal officers from unlawfully dissipating public funds is a right common to all taxpayers, great and small.” Engstad v. Dinnie, 8 N. D. 1, page 12, 76 N. W. 292. This relator township has an interest analogous to that of a taxpayer in the application of all assessments levied to meet the construction of said Viking drain. The township’s interest in real property, like all in said drainage district, is, or may be, subject to reassessment for any deficiency not met by the collection of the assessment made. Therefore, like any ordinary landowner in said drainage district subject to assessment, relator township is entitled to have all funds so collected as penalty and interest, by whomsoever paid, and belonging to said Viking drain fund, and unlawfully diverted therefrom to Richland county, ascertained in amount and retransferred into said drain fund. It was proper for the judgment to so direct.
Judgment for the issuance of a peremptory writ of mandamus is ordered affirmed, with costs.