Relator was convicted in the municipal court of Bemidji of petit larceny, and sentenced to imprisonment in the county jail for the term of ninety days. He thereafter sued out a writ of habeas corpus, alleging that his imprisonment was illegal and without authority of law, in that the said municipal court was never legally created or established. The writ was discharged by the court below, and relator appealed.
We are confronted at the outset with the question whether the legal existence of the court in which relator was convicted and sen-*139fenced may be inquired into in a proceeding of this kind. If not, then the other questions presented require no attention.
The office of the writ of habeas corpus is to afford the citizen a speedy and effective method of securing his release when illegally restrained of his liberty. Its scope, when directed to an inquiry into the cause of imprisonment in judicial proceedings, extends to questions affecting the jurisdiction of the court, the sufficiency in point of law of the proceedings, and the validity of the judgment or commitment under which the prisoner is restrained. It cannot be employed as a writ of quo warranto to inquire into the title of the person to the office of judge of the court whose judgment or commitment is assailed. 15 Am. & Eng. Enc. (2d Ed.) 168. Nor as a writ of error to review alleged errors committed on the trial. Nor as an appeal or writ of certiorari. State v. Kinmore, 54 Minn. 135, 55 N. W. 830, 40 Am. St. 305. At common law courts of superior jurisdiction would review on this writ commitments by inferior magistrates, and in doing so sometimes go back of the commitment, and inquire into the grounds thereof and their sufficiency. This wide scope of inquiry, however, came from the superiority of the higher court, and not from statutory authority. But the rule in many of the states has been modified or changed, and, where so modified, the writ extends as a general rule to defects appearing upon the face of the record only. Church, Habeas Corpus, § 234.
The rule in this state by statute is that, if the judgment be rendered or the commitment issued by a competent court and be fair upon its face, nothing further than the jurisdiction of the court will be inquired into. State v. Sheriff of Hennepin County, 24 Minn. 87; State v. Billings, 55 Minn. 467, 57 N. W. 206, 794, 43 Am. St. 525; State v. Kilbourne, 68 Minn. 320, 71 N. W. 396; State v. Norby, 69 Minn. 451, 72 N. W. 703. Our statutes provide (section 4586, R. E. 1905) that where, upon the return of the writ, it shall appear that the person alleged to be restrained of his liberty is held and detained by virtue of a final judgment of a competent court of civil or criminal jurisdiction, he shall be remanded to the custody of the officer. Section 4587 provides that, if it shall appear on the return of the writ that the prisoner is in custody by virtue of a process of a court "legally constituted,” he can be discharged only when it *140shall be made to appear (1) that the court under which the prisoner is committed was originally without jurisdiction to render the judgment; or (2) by some act or omission subsequently occurring the prisoner is entitled to his discharge; or (3) when the process under which he is held is in matter of substance defective; or (4) when issued without authority; ór (5) when the person detaining the prisoner is not the person authorized by law to detain him; or (6) where the process was wholly unauthorized by judgment or provision of law. These statutory provisions abrogate the common-law rule, and preclude the right of the court to go behind the judgment or commitment and determine the. validity thereof from matters de hors the record, except in those cases where the evidence is brought up on certiorari as ancillary to the writ of habeas corpus as in the case of In re Snell, 31 Minn. 110, 16 N. W. 692.
It is not contended by relator that any of the grounds for release specified in the statute are present in this case, except that the municipal court of Bemidji was not legally constituted, was not a “competent court” within the meaning of the statute, and had therefore no jurisdiction to hear, try, or determine the prosecution against relator. We are of opinion that this question cannot be determined in this proceeding.
The constitution of the state expressly authorizes the legislature to create and establish such courts inferior to the supreme and district courts as public interests may from time to time require. Under this authority the legislature by section 12o, R. U. 1905, provided for the organization of municipal courts in certain villages and cities of the state upon a compliance with the conditions therein prescribed. In April, 1905, the city council of Bemidji, a city coming within the terms of the statute, acting under and pursuant to its provisions, duly resolved that a municipal court be established in and for that city, the resolution to take effect and be of force on August 1 following. The proceedings' of the council were in all things in conformity with the law, and the resolution was duly submitted'to the city mayor for his approval or rejection. The mayor vetoed the resolution, whereupon, in the due course of events, it was 'again brought before the council for consideration in connection with the mayor’s disapproval. It was then passed by unanimous vóté óf *141the council over the veto. Thereafter the court was duly constituted by the appointment of a judge and clerk, as provided for by the statute under which the council acted, who qualified and entered upon the discharge 'of their duties. It was before this court as thus established that relator was convicted. It is his contention that the approval of the resolution by the mayor was an essential prerequisite to the organization of the court, and, he having disapproved or vetoed the same, that was an end of the matter; that the council had no power or authority to pass the resolution over his veto, hence that the court was not legally created or established. We do not pass upon the question whether the court was legally created or intimate any opinion to the effect that it was not. The question is not reached.
The question whether the legal existence of a court may be inquired into on habeas corpus proceedings has been answered by different courts both in the affirmative and the negative (21 Cyc. 301); the weight of authority, however, as we view the matter, being with those courts which hold under statutes like those of this state that the writ cannot reach that question. That the right of a person to exercise the functions of a public office, who has qualified and entered upon the discharge thereof under color of authority, though his title be not good in point of law, cannot be called in question collaterally upon habeas corpus or other indirect method, is sustained by all the courts. Note to 87 Am. St. 177; Sheehan’s Case, 122 Mass. 445, 23 Am. 374; In re Manning, 76 Wis. 365, 45 N. W. 26; In re Brainerd, 56 Vt. 495; Ex parte Ward, 173 U. S. 452, 19 Sup. Ct. 459, 43 L. Ed. 765; Patterson v. State, 49 N. J. L. 326, 8 Atl. 305. No reason occurs to us why the same rule should not apply to de facto municipal corporations and de facto courts.
The authorities maintaining that the legal existence of the court may thus be inquired into proceed on the theory that there can be no such thing as a de facto court. In re Norton, 64 Kan. 842, 68 Pac. 639, 91 Am. St. 255. But that doctrine is not fully supported either on principle or authority, at least it is not without exceptions.. A municipal corporation, although not legally organized, is still a de facto corporation. State v. District Court of Ramsey County, 90 Minn. 118, 95 N. W. 591; St. Paul Gaslight Co. v. Village of Sand*142stone, 73 Minn. 225, 75 N. W. 1050; 1 Dillon, Mun. Corp. (4th Ed.) 43; Cooley, Const. Lim. (7th Ed.) 363; 20 Am. & Eng. Enc. (2d Ed.) 1135; Speer v. Board of Co. Commrs. of Kearney County, 88 Fed. 749, 32 C. C. A. 101; City of Omaha v. City of South Omaha, 31 Neb. 378, 47 N. W. 1113; Miller v. Perris Irrigation District (C. C.) 85 Fed. 693. And the authorities hold that in such case the acts of the municipality and its officers are as to third persons lawful and binding, and the legal existence or right of a municipality to continue to exercise its functions can be questioned only by the state in direct proceedings brought for that purpose. Logically, if a corporation has only a de facto existence, the offices created by the act or proceeding creating it can have no superior legal quality. They necessarily must be de facto, for there can be no de jure office of a municipal corporation existing only in theory, and the incumbents thereof manifestly are de facto officers of a de facto corporation. Courts in attempting to adhere to the abstract rule that there must in all cases be a de jure office have in cases where a de facto corporation has been held to exist invented a theory of potential existence to take the place of the lawfully created office. Carleton v. People, 10 Mich. 250; Yorty v. Paine, 62 Wis. 154, 22 N. W. 137; Fowler v. Bebee, 9 Mass. 231, 6 Am. Dec. 62; Smith v. Lynch, 29 Oh. St. 261; Buck v. City, 109 Cal. 504, 42 Pac. 243, 30 L. R. A. 409. There can, however, be no difference in point of substance between an office having a potential existence — i. e., one that might lawfully be created — and one existing in fact though not legally created. In neither case is it a de jure office. This precise question was discussed by .the Missouri court of appeals in Adams v. Lindell, 5 Mo. App. 197, where the court reached the conclusion, as we think correctly, that the existence of a de jure office is not in all cases indispensable to the existence of a de facto officer. If this is not sound, then there can be no such thing as a de facto corporation or a de facto court. Burt v. Winona & St. P. R. Co., 31 Minn. 472, 18 N. W. 285, 289.
This court has held, and we are supported by courts of high standing, that there may not only be de facto municipal corporations but de facto courts, and that the validity of their acts cannot be questioned in collateral proceedings. St. Paul Gaslight Co. v. Village of Sandstone, supra; State v. Board of Co. Commrs. of Crow Wing County, *14366 Minn. 519, 68 N. W. 767, 69 N. W. 925, 73 N. W. 631, 35 L. R. A. 745; State v. Village of Harris, 102 Minn. 340, 113 N. W. 887, 13 L. R. A. (N. S.) 533; Burt v. Winona & St. P. R. Co., supra. In the last case cited, which is analogous to the one at bar, it was held that the municipal court of Mankato, created by an unconstitutional statute, was a de facto court, and that its legal existence could not be questioned in a collateral proceeding. A similar conclusion was reached in Trumbo v. People, 75 Ill. 561, and in Leach v. People, 122 Ill. 420, 12 N. E. 726, where the status of a school district and its officers which had been illegally established was involved. It was held that the regularity of the proceedings in the formation of the school district could not be inquired into collaterally. A de facto county organization was sustained, and the acts of its officers held immune from collateral attack in Merchants v. McKinney, 2 S. D. 106, 48 N. W. 841. See also Brown v. O’Connell, 36 Conn. 432, 4 Am. 89; Campbell v. Com., 96 Pa. St. 344; Walcott v. Wells, 21 Nev. 47, 24 Pac. 367, 9 L. R. A. 59, 37 Am. St. 478.
In the Burt case this court [page 476] speaking through Chief Justice Gilfillan, said: “It would be a matter of almost intolerable inconvenience, and be productive of many instances of individual hardship and injustice, if third persons, whose interests or necessities require them to rely upon the acts of the occupants- of public offices, should be required to ascertain at their peril the legal right to the offices which such occupants are permitted by the state to occupy. Taking even the narrowest definition of an officer de facto, viz., that he is one who is exercising the duties of an office under color of legal right to the office, the reasons that justify the doctrine apply with equal force to a court or office where the same may be said to exist under color of right; that is, under color of law. That there may be a de facto municipal corporation, and consequently de facto offices of the same, follows from the rule laid down in Cooley, Const. Rim. *254: If a municipal corporation appears ‘to be acting under color of law and recognized by the state as such, such a question (that is of the legal existence of the corporation) should be raised by the state itself by quo warranto, or other direct proceeding’— and it is sustained by many authorities, holding that the question cannot be raised collaterally. State v. Carr, 5 N. H. 367; People v. *144Maynard, 15 Mich. 463; Stuart v. School Dist., 30 Mich. 69; Bird v. Perkins, 33 Mich. 28; President, etc. v. Thompson, 20 Ill. 197; Kettering v. City of Jacksonville, 50 Ill. 39; Town of Geneva v. Cole, 61 Ill. 397; Kayser v. Trustees of Bremen, 16 Mo. 88; State v. Weatherby, 45 Mo. 17; City of St. Louis v. Shields, 62 Mo. 247; 1 Dillon on Mun. Corp. § 43, (22).”
The municipal court of Bemidji was organized under color of law, proceedings for that purpose were at most irregular, and, within the Burt case, it was a de facto court, and its judge and clerk de facto officers. Applying the general rule referred to, namely, that the title of a de facto officer cannot be attacked collaterally, to the de facto court, it follows that relator cannot be heard to complain of the manner in which the municipal court of Bemidji was established. Ex parte Strang, 21 Oh. St. 610; In re Ah Lee (D. C.) 5 Fed. 899, 6 Sawy. 410; State v. Carroll, 38 Conn. 449, 9 Am. 409. See note to King v. Philadelphia, 21 L. R. A. 141; State v. Harris, 47 La. Ann. 386, 17 South. 129. A de facto court is therefore a “competent court,” or a “legally constituted court,” within the meaning of our habeas corpus statute, for its judgments and proceedings are not open to collateral attack. This rule, of course, does not apply to a court created without color of authority or to a mere usurper. Ex parte Strahl, 16 Iowa, 369.
The learned trial court therefore properly discharged the writ, and its order in the premises is affirmed.