Kellam, J.
The questions in this case will be as well understood from a brief statement of the salient facts as by a reproduction of the pleadings; Plaintiff (respondent here) brought the action in ejectment to recover possession of a lot in the city *174of Deadwood adversely held by appellant. A part of the town-site of Deadwood, including this lot, was entered by the county judge of Lawrence county, under the congressional townsite act (Sections 2380 et seq., Rev. St. U. S. 1878), in the month of June, 1878; but on account of adverse mineral claims, the entry was suspended until March, 1882, when, so far as these premises are concerned, it was allowed and patent issued therefor in November, 1886. In May, 1890, the then county judge of said county, by virtue of a sale at public auction of this lot, as an unclaimed lot, — held and made, as is alleged, in pursuance of the provisions of the territorial statute, for the benefit of the board of education of said city of Deadwood, — officially made and delivered to the plaintiff a quit-claim deed of said lot.. Upon the trial this deed was offered in evidence as the immediate source of plaintiff’s title. The defendant objected that it was incompetent, that the party purporting to execute the same had no authority at that time to make it, that there was no showing of facts entitling the plaintiff to such deed, and that the deed executed at the time purported is void. The objection was overruled, and this is the first error assigned.
Defendant’s contention was and. is that, as the deed could only be issued upon the existence of certain prerequisite conditions, these conditions were, in an essential sense, jurisdictional, and that the deed was only admissible after it was shown that such conditions existed. The plaintiff, on the other hand, contended that in determining who was entitled to a deed, and in making the same, as the result of such determination, the county judge acted judicially, and the correctness of his decision could not be questioned collaterally. We think the deed was admissible, not on the ground that its allowance was in the nature of a judicial award by the county judge, and therefore unassailable collaterally, but on the ground that, the law having allowed him to issue the deed only if certain prerequisites had been complied with, it will be presumed that he did his duty, and that the conditions precedent had been performed. *175See Mechem, Pub. Off. § 579; Bank v. Dandridge, 12 Wheat. 70; Cofield v. McClelland, 16 Wall. 834; Taylor v. Railroad Co., 45 Minn. 66, 47 N. W. 453; Terry v. Berry, 13 Nev. 514. This is a presumption constantly indulged. Important property rights would be greatly impaired, and rendered insecure, by simple lapse of time, if such presumption were withdrawn. Take this case for illustration. In a few years, and less than would establish prescriptive rights, and although there might be no good ground for doubting the fact, it might be impossible on account of the death of witnesses, to prove the performance of the several acts which ought to have -preceded the making of this deed, to entitle the county judge to issue it. In such case the title ought not to fail, and then, as now, the deed should be received as prima facie evidence that all that ought to have been done was done. It is only a presumption, but it is sufficient, in the first instance, to let in the deed.
The patent from the United States to the county judge of Lawrence county, and his successors in office, conveying this lot and others in trust, was already in evidence; and this deed, regular upon its face, from the county judge, as trustee, showed a prima facie title in Goldberg. We cannot, however, agree with respondent’s counsel that Goldberg’s title, as evidenced by this deed was unassailable, except by a direct and independent action to set it aside. It is only when certain conditions pre-exist that the trustee, whether county judge or municipal officer, has the right or authority to convey. Because the rule is that public officers generally observe, rather than violate, the law, the presumption is that he did not deed in vio - lation of law, but only when, and to whom, he ought to deed; but, notwithstanding such presumption, we think it was competent for Kidd, in an action for his eviction by Goldberg on the strength of his deed, to plead in defense, and show, that such prerequisite condition did not in fact exist, and that consequently the county judge had no authority to make such deed; in other words, to plead and show the very things that; *176in an equitable action for that purpose, would entitle him to have the deed held void, or its holder a-trustee of the legal title for his benefit. In support of such defense the same facts would be admissible in evidence, and with the same effect, as in a direct action against the deed. The principle is concisely stated in Chase v. Peck, 21 N. Y. 581, which was an action in ejectment. Judge Denio said: “But since the blending of legal and equitable remedies, a different rule must be applied. The defendant can defeat the action upon equitable principles; and if, upon the application of these principles, the plaintiff ought not to be put into possession of the premises, he cannot recover in the action.” This question of equitable defenses in actions at law is discussed in Pomeroy’s Remedies and Reme dial Rights (Section 94 et seq.,) and the learned author states the rule to be that: “Where the nature of the subject matter, and the relations between himself and the plaintiff, are such that he could have maintained an independent suit in equity against the plaintiff, and procured specific relief thereby, or could have filed a cross bill, under the old practice, he may now obtain the same remedy upon his answer; at all events, as was before remarked, if the demand alleged in the answer constitute a valid counter claim.” This same principle was applied in Cornelius v. Kessel, 58 Wis. 237, 16 N. W. 550, affirmed in 128 U. S. 456, 9 Sup. Ct. 122. That action was ejectment. Plaintiff’s title was a patent issued by the United States. The defendant pleaded facts tending to show that he was the equitable owner of the land when the patent issued, and, the defense being proved, defeated the plaintiff’s legal right under the patent.
But, assuming that the action of the trustee awarding and making the deed under the townsite law is, in general, quasi judicial, as held in Territory v. Nowlin, 3 Dak. 349, 20 N. Y. 430, still the decision, in any case, can only have judicial quality when it is the result of a judicial inquiry upon a matter then subject to judicial investigation. In this case, it appears the *177deed was not given to Goldberg because the trustee found that he was entitled to it as an “occupant"’ of the lot, — that is, not as the result of a judicial inquiry which the statute authorized him to make, — but was sold to him at public sale as an unclaimed lot, and because he was the highest bidder therefor. It does not appear how the judicial functions of the trustee could, in such case be called into exercise.- He was authorized to sell, for the benefit of the board of education, such lots as were unclaimed; and, from the fact of his so selling, it will be presumed that the lot was unclaimed, but the presumption is not conclusive. The county treasurer sells land for unpaid taxes, and the sale raises the presumption of nonpayment; but it would not be tolerated that, because he sold a particular piece, it would be conclusively presumed that the tax had not been paid. So, here, the right of the county judge to sell this lot depended, by the terms of the law, upon its being unclaimed. That question was open to inquiry, and was not foreclosed by the fact of the sale. Ignoring, for the moment the 90-day statutory bar, which will be noticed latter, we think that, in this action, defendant might show, in defense of his possession facts which would show that, at and before the issuing of this deed, he was the equitable owner of the lot in question; that he had in fact complied with all the conditions which the law required. of him; that the county judge then held the legal title as trustee for him, and had therefore no power to convey it to another, in defiance of his rights; and that Goldberg, taking it with actual notice of his rights, took the title subject thereto. If, before and at the time this deed was made, Kidd had done everything required of him to earn the lot — to entitle him to it —it was equitably his; and the trustee had no more right or authority, so long as these conditions lasted, to deed it to another than he would have had if he had already deeded it to Kidd. It has often been held that, when the right to a patent once becomes vested in a settler, it is equivalent, so far as the *178government is concerned, to a patent actually issued. Stark v. Starr, 6 Wall. 402; Barney v. Dolph, 97 U. S. 656; Cornelius v. Kessel, supra.
We now reach the only point in the case which can, as it seems to us, present very serious difficulty. The facts which defendant Kidd pleaded, and presumably would have proved, were, in effect, that when the townsite was first entered the lot in question was actually occupied by Miller, McPherson & Lake and that they continued- to be the occupants thereof until some time after the entry was finally allowed and confirmed; that thereafter they conveyed their rights in and to said lot, as occupants thereof, to Green & Finley, who in turn conveyed - in the same manner, to defendant Kidd. The right of an occupant to thus transfer his interest to another has been often recognized; and by Section 1171 of our Compiled Laws, it is provided that in the execution of his trust the county judge may deed to the assigns of such claimant. Appellant’s contention is that when the entry was made, in 1877, it inured to the benefit of the then occupants, they becoming at once the equitable owners; that the county judge took and held the legal title simply as their trustee, and it was not in the power of the territorial legislature to subsequently add new conditions, upon which their ownership should depend. The act of congress under which this townsite was entered authorized the county judge “to enter * * * the land so settled and occupied in trust for the several use and benefit of the occupants thereof according to their respective interests; the execution of which trust as to the disposal of the lots in such town, and the proceeds of the sale thereof, to be conducted under such regulations as may be prescribed by the legislative authority of the state or territory in which the same may be situated. ” This was the law when, and under which, this townsite was entered. It was entered in 1878. The county judge took the legal title to this lot in trust for defendant’s assignors. Assuming, as we must, in disposing of the questions now before qs, that the *179statements of the answer are true, the county judge took the legal title to this lot in trust for defendant’s assignors, subject only to such regulations as the territorial legislature might legally make as to the execution of such trust. By the terms of the act, such regulations were to be in respect ‘ ‘to the disposal of the lots in such town and the proceeds of the sales thereof. ” As to the lots actually occupied when the entry was made, we think the word “disposal” must be understood to mean ‘‘distribution,” which words are often used synonymously for, as to such lots, they were already disposed of, — that is, they became at once the property, equitably, of their occupants. In Ashby v. Hall, 119 U. S. 529, 7 Sup. Ct. 308, the court said the regulations which the local legislatures were authorized to make “might extendió provisions for the ascertainment of the nature and extent of the occupancy of different claimants of lots, and the execution and delivery to those found to be occupants in good faith of some official recognition of title in the nature of a conveyance.” The regulations contemplated were evidently such as would be necessary or convenient in effectuating the purposes of the trust. Under the power thus conferred to make regulations, the territorial legislature provided that, immediately after the entry by the county judge, he should give notice by publication to all persons having claims for money advanced or services rendered to present and file a certified statement thereof, and that such notice should further direct that every person claiming to be an occupant, or to be entitled to the right of possession, of any lot, should, within 90 days of the first publication of such notice, make a verified statement of his claim as to occupation, improvements, etc., with a proper description of the lot or parcel of land claimed; and it is then provided that ‘‘all persons failing to furnish such statement as herein required, within the time specified in said notice, except minors and insane persons, shall be forever barred of the right of claiming or recovering such lands, or any interest or estate therein, or any part or parcel thereof. ” *180Tbe scheme of the federal law, plainly, was that, as a matter or convenience, the county judge should take the legal title to lots, of which the law itself made the actual occupants the real and equitable owners, and, as a further matter of convenience, invested the local legislature with authority to make regulations under which the county judge, as such trustee might determine who were the actual beneficiaries of the trust, and consequently to whom he should convey the legal tille. The occupant of a lot at the time the entry of the townsite is made is its real owner. Cofield v. McClelland, 16 Wall. 334; Stringfellow v. Cain, 99 U. S. 610.
It was doubtless competent for the legislature to prescribe reguiations by which the county judge, as trustee, might and should determine to whom he should make conveyance of the legal title; and an actual occupant, although the equitable owner, could not obtain the legal title except in pursuance of such regulations. But, under the authority to make such regulations for such purpose, was it competent for the legislature to say that the equitable owner, continuing in open and uninterrupted possession, should forfeit his rights under the congressional law unless, within a limited number of days, he put himself in position to receive the full legal title? Failure to file a claimant’s statement might be taken as evidence of his intention to abandon, but it could not so operate here; for the defendant and his assignors have been in actual and constant possession since prior to the entry of the townsite, and have made valuable improvements on the lot. The law of congress prescribes no time within which the county judge’s trust is to be discharged, and does not — expressly, at least — impose any obligation upon the occupant of a lot to apply for and take the legal title thereto. It simply makes the county judge trustee for the occupant,- as equitable owner; and for the legislature to say that, no matter what hindering causes intervene, the vested equitable rights of the cestui que trust are absolutely and forever forfeited by IBs failure, for 90 days, — not from actual *181notice, but from the first publication of notice, — to furnish such prooi to the county judge as will add to his equitable title, with which he may at the time be content, a legal title, which he may not then want, is, in our judgment, a questionable exercise of the authority contemplated or conveyed by the act of congress to make regulations for the orderly administration by the county judge of the trust committed to him by such act of congress. Doubtless, the legislature might properly prescribe regulations for the orderly ascertainment by the county judge of such facts as would enable him to intelligently close out his trust by making deeds to such persons as were entitled to them, and that no occupant could claim or obtain a deed without compliance therewith; and perhaps the legislature might fix a time within which, under such regulations, application for deeds should be made, and that it could not be made after-wards; but this is essentially different from saying that unless such application were made within a definite number of days the equitable rights conferred by the act of congress should be forfeited.
Defendant’s grantors were, as stated in the answer, in actual occupation of this lot when the townsite entry was made, in June, 1878, and contributed to the expense thereof. Their equitable interest in, and ownership of, the lot, became at once a vested right, subject only to such regulations as the local legislature might properly make under the authority referred to. While they so continued in such occupation and ownership, and while it was still such vested equitable right, this territorial statute was passed, barring their right of claiming or recovering such lot unless the verified statement provided for in such statute was made within 90 days. We do not now undertake to define the legal effect of this provision as a statute of limitation,' further than to say that if, by it, it was intended that a failure, for 90 days, to file such statement as would entitle an occupant to a conveyance of the legal title should have the effect of destroying the occupant’s pre-existing equitable *182interest in the lot, and deprive him of the right of defending his continuous possession, it is, to that extent, inoperative. It does not occupy the ground of a valid limitation law, bat is an attempt to destroy vested rights, and is an unlawful confiscation of property. In Groesbeck v. Seeley, 13 Mich. 342, the court said: “The only manner in which a party holding a lawful and vested right in property can be prevented from asserting it against one which was not lawful in its inception is by the operation of limitation laws. These laws do not purport to take away existing rights, although their operation may often have substantially that result. But they are designed to compel parties whose rights are unjustly withheld from them to indicate their claims within a reasonable time. If a person who has been ousted of his possession or dominion desires to regain it he knows that he must resort to the means which are prescribed by the law, either by the peaceable act of a party himself, or by legal prosecution. A limitation law simply requires him to proceed and enforce these rights within some reasonable time, on pain of being declared to have abandoned them. Such laws can only operate on those who are not already in the enjoyment and dominion of their rights. A person who has a lawful right, and is actually and constructively in possession, can never be required to take active steps against opposing claims.” In Baker v. Kelley, 11 Minn. 496 (Gil. 358), the court says: ‘‘Limitation laws always must operate to compel a party to enforce or prosecute his claim within a reasonable time, but a party who is in the enjoyment of his rights cannot be compelled to take measures against an adverse claimant; and a law taking away the rights of a party, in such cases, is an unlawful confiscation, and in no sense a limitation law.” In his work on Constitutional Limitations, Judge Cooley says. “Limitation laws cannot compel a resort to legal proceedings by one who is already in the complete enjoyment of all he claims.”
Upon the facts stated in the answer, Kidd became the *183equitable owner of this lot simultaneously with the entry of the town site, and the legislature could not, by a law subsequently passed, divest him of such ownership, either by direct legislation, or, indirectly, by such subsequent statute of limitation, on account of his failure to do something which the act of congress which gave him the equitable ownership of the lot did not require of him. Every law and every contract which creates a trust contemplates the exercise of good faith by all parties to it. If Kidd, even after the entry of the town site, had abandoned his occupation of this lot, it might have been taken as a relinquishment of his equitable right to it. There is no such element in this case. On the contrary, he was in open occupation of the same at the time of the sale, and, in addition to general notice conveyed by such possession, affirmatively notified the purchaser, Goldberg, and the county judge, as trustee, of his claimed equitable rights. Goldberg bought with full and actual notice, and, whether or not he has redress for the consideration paid, he is not in position to complain. We think the answer stated a defense, and the refusal of the trial court to receive evidence under it was error, for which the judgment in favor of the plaintiff must be reversed. The judgment is reversed, and the case remanded for a new trial.