De Haven, J.
The defendant was convicted and sentenced to the state prison for the term of five years for the crime of assisting one Lee Yick, confined in the county jail of Alameda County, to escape therefrom. From this judgment, and an order denying his motion for a new trial, the defendant has appealed to this court.
Upon the trial, the defendant requested the court to give the following instruction, which was refused: “ It is not unlawful for one who is restrained unlawfully, and without authority and process of law, to withdraw from his place of confinement and depart therefrom. Such *422departure is not an escape, within the meaning of the law. And so, likewise, when one assists, without violence, a person who is confined without any authority of law, and without any process of law, to depart from his place of confinement.”
It appears from the evidence that Lee Yick, whom the defendant is accused of assisting to escape, was, with the consent of a deputy sheriff in charge thereof, placed in the Alameda County jail by a deputy United States marshal for the southern district of California, and that the only authority of said deputy marshal consisted of a “finding ” made by a United States circuit court commissioner for the southern district of California, at San Diego, which, after reciting that said Lee Yick was charged with having unlawfully come within the United States from a foreign place, and had been examined before him on that charge, proceeded to state, as his conclusion from the evidence, that “Lee Yick is a Chinese person and laborer; that he came within the United States on the first day of August, A. D. 1890, in the county of San Diego, state of California, from the republic of Mexico. Now, therefore, from the foregoing facts I find that the said Lee Yick was found unlawfully within the United States, and that he is not lawfully entitled to he in or remain in the United States.” No formal judgment was ever made or given upon this “ finding,” nor order or direction given by the commissioner or any court that the said Lee Yick be removed from the southern district of California to some other place in the United States for the purpose of returning him to the country whence he came, and that he be restrained of his liberty for that purpose.
1. It is provided by section 1601 of the Penal Code, that “the sheriff must receive, and keep in the county jail, any prisoner committed thereto by process or order issued under the authority of the United States, until he is discharged according to law.”
Was the said Lee Yick committed to the county jail of Alameda under any process or order issued under the *423authority of the United States? We think not. Section 13 of the act of Congress of September 13,1888, “ to prohibit the coming of Chinese laborers to the United States” (25 U. S. Stats, at Large, 476), provides that any Chinese person found in the United States may be brought before a commissioner of the United States court, “ and when convicted upon a hearing, and found and adjudged one not lawfully entitled to be or remain in the United States, such person shall be removed from the United States to the country whence he came.....A certified copy of the judgment shall be the process on which such removal shall be made, and it may be executed by a marshal of the district, or any person having the authority of a marshal under the provisions of this section.” It is evident that there is nothing in the language just quoted which would give to the above “ finding ” or declaration of the United States circuit court commissioner, that Lee Yick was unlawfully in the United States, the effect to justify the action of the deputy United States marshal in taking said Lee Yick into custody and removing him from the district in- which he was found to the county of Alameda, or for the sheriff of the latter county to imprison him in its jail by direction of such deputy marshal. The authority of a marshal to execute process is confined to the district for which he is appointed (U. S. Rev. Stats., sec. 787; Walker v. Lea, 47 Fed. Rep. 645), unless in a case otherwise specially provided for by statute, or the lawful order of some court. The original exclusion act of May 6, 1882 (22 U. S. Stats, at Large, 58), provided that Chinese unlawfully in this country should be removed by direction of the President. This provision is omitted from the act of September 13, 1888, and the removal is made a consequence of the judgment of the court or commissioner, that such Chinese person is not entitled to remain in the United States, but no special direction is given in the statute for the removal of such person from the district in which he is convicted to the port of some other district for the purpose of carrying such judgment into execution.
*424By section 1014 of the United States Revised Statutes, it is provided that when an offender is committed in “ any district other than that where the offense is to be tried, it shall be the duty of the judge of the district where such offender or witness is imprisoned seasonably to issue, and of the marshal to execute, a warrant for his removal to the district where the trial is to be had.” It may be that in analogy to such a proceeding the United States district court for the southern district of California was possessed of authority .to make an order directing the said Lee Yick to be removed from that district to some port of shipment beyond its limits, that he might be deported from this country, and could have lawfully committed him to its marshal for that purpose, or, possibly, the commissioner could have made such order; but the finding of the United States court commissioner, before referred to, is not equivalent to such an order, and without such order the marshal had no more authority to imprison Lee Yick in the northern district of California than he would have had to take him to New York or Alaska for the purpose of returning him to the country whence he came. It follows from this that Lee Yick was never lawfully committed to the jail from which the defendant is charged to have assisted him in making his escape; and this brings us to the point where we must consider whether the departure of Lee Yick from a jail in which he was confined, in violation of law, was a crime; for if such departure was not a crime, the .defendant was guilty of no offense in assisting him without violence to leave the place of his imprisonment, and the court erred in refusing to so instruct the jury.
2. It is contended by the attorney-general that the question whether Lee Yick was or was not lawfully confined in jail is immaterial, and that the offense of assisting a prisoner to escape from jail is made out when it is shown that a defendant has assisted a person unlawfully confined therein to free himself from the restraint of a prison. In support of this proposition, it is argued that the purpose of the law is to throw a protection around *425jails, by making it unlawful for friends of those confined therein to proceed in any other manner than by the writ of habeas corpus, or other legal process, for the enlargement of such persons.
We cannot accept this view. An escape is classed as a crime against public justice, and the law, in declaring it to be an offense, proceeds upon the theory that the citizen should yield obedience to the law; that when one has been, by its authority or command, confined in a prison, that it is his duty to submit to such confinement until delivered by due course of law, no matter whether he was committed to await a future trial, or as a punishment after judgment of conviction, or for any other purpose authorized by law. But when the imprisonment is unlawful, and is itself a crime, the reason which makes flight from prison an offense does not exist. In such a case the right to liberty is absolute, and he who regains it is not guilty of the technical offense of escape. And this view seems to be the one which is adopted by the courts, without dissent from any.
In the case of State v. Leach, 7 Conn. 452, the defendant was tried for an escape, and it appearing that his imprisonment was illegal, the court held that the act, instead of being a crime, was justifiable, and further said: “ It hence results that the keeper of the jail is vested with no authority; the building in which the prisoner was confined is not a jail, but as to him a mere private building, and hence he might regain his liberty, of • which he was unjustly deprived; and it is no part of the case, that he made use of more force than was necessary to accomplish this object.”
That there can be no escape, in the sense of the law, unless there was a lawful custody, is also held in Housh v. People, 75 Ill. 487; State v. Beebe, 13 Kan. 589; State v. Jones, 78 N. C. 420; 2 Bishop’s Crim. Law, sec. 1065.
The cases cited by the attorney-general are not in conflict with the conclusion we have reached, as an analysis of them will show. In Rex v. Waters, 12 Cox *426C. C. 390, the prisoner was arrested without warrant, taken before a magistrate, and remanded for three- days. He broke out of the lock-up and returned to his home, but appeared before the magistrate at the day fixed for. his examination, and was discharged because there was no evidence against him. He was then charged with the escape, and convicted. The conviction was sustained, the court holding that the magistrate had authority to remand him, and that he had escaped from a lawful custody, In this respect that case is like that of State v. Lewis, 19 Kan. 260, in which it was held that the lawfulness of the commitment did not depend upon the actual guilt or innocence of the prisoner, and that even though innocent, it was his duty to remain until discharged by authority of law. State v. Murray, 15 Me. 103, was a case where there was an informality in the commitment, and the court held that this would not justify an escape. To the same effect is Commonwealth v. Morihan, 4 Allen, 586. The distinction between these two latter cases and the one before us grows out of the wide difference which must necessarily exist between an imprisonment without any process, and wholly without authority of law, and an imprisonment under a process which is simply irregular in form; and this distinction is clearly stated and recognized in 2 Bishop’s Criminal Law, sec. 1094; Goodwin v. Griffis, 88 N. Y. 629; Dunford v. Weaver, 84 N. Y. 445. Indeed, for a mere irregularity in the form of a warrant or commitment, the court would not be authorized to discharge a prisoner on habeas corpus (Pen. Code, sec. 1488), and much less would the prisoner himself be justified in treating it with contempt, as he might do if it were wholly void and incapable of amendment. The cases just referred to, as well as those in which the arrest of a person and his imprisonment for a limited time without any warrant or commitment are authorized by law, are clearly distinguishable from this, in which the alleged escaping prisoner was held without even color -of authority. It may be stated as the clear result of all the cases in which the point has *427arisen, that mere confinement within the walls of a prison, in violation of the law of the state, is not an imprisonment from which it is a crime to escape if opportunity offers, and the court erred in refusing to give the instructions requested by defendant on this point.
Judgment and order reversed.
McFarland, J., Paterson, J., Sharpstein, J., Harrison, J., and Garoutte, J., concurred.