delivered the opinion of the court.
Juan Alvarez Peña made an application to the. District Court of San Juan for a writ of habeas corpus, such writ being served upon Juan Quiñones, second lieutenant of the Insular Police and chief of the detective force, who, in his return admitted the custody of the prisoner under the special conditions which were set out in the return. A hearing was had in the district court which refused to grant the petition. The appeal in this case is from the order of the court refusing to liberate the prisoner.
*582The petition set up that «Juan .Alvarez Peña, a Spanish subject, of age, a tradesman, married, and a resident of Telde, Grand Canaries, was deprived of his liberty, being detained in honse No. 5 Cristo Street, in this city, where there is a department of the Government of Porto Eico called “Office of the Insular Public Detective, ’ ’ snch detention being at the disposition of the consul of Spain in Porto Eico; that this deprivation of liberty of the said Juan Alvarez Peña was brought about by the officer of the detective force of San Juan on the 28th clay of May, 1906, on board the Spanish boat Buenos Aires, coming from the Canary Isles, in which ship the petitioner was to have proceeded to Cuba, where important business matters claimed his presence; that such detention was made at the instance of the Spanish consul, the said prisoner having been conducted first to the office of the said consul and later to the office and prison of the detective force; that such detention was-illegal because neither by the treaty of Paris of the 10th of December, 1898, nor by the treaty of the 17th of February, 1834,- nor yet by the treaty signed in Madrid on the 3rd day of June, 1902, the only treaties which it was alleged are today in force between, the United States and the kingdom of Spain, was there.any authority to 'detain or deprive a citizen or subject of Spain of his liberty in the territories of the United States of,América except by reason of a crime so denominated by the Codes of the several States and Territories. The return of Juan Quiñones set up that that officer held the said Juan Alvarez Peña as a prisoner by order of the Spanish consul at San Juan, Porto Eico, in whose arrest on board of the Spanish ship Buenos Aires he, said officer, aided said consul; that he held said prisoner at the disposition of the Spanish consul by virtue of an order ■ which he received from said consul; that. he. received the order verbally from the Spanish consul, and. therefore failed to have any written authority; that the crime for which the prisoner was detained according to what he, said officer, was *583told and according to a cable which, said consular authority showed him, is the crime of " estafa. ’ ’
The case was argued before us on the 16th day of June, 1908, by counsel for the appellant and petitioner. The fiscal of this court, assistant to the Attorney General, was likewise present and submitted that he was there in a merely advisory capacity subject to the orders of the court, as The People of Porto Eico had no connection or interest in the case. No one was present on behalf of the consul or the Spanish authorities, the fiscal stating that the consul had been advised of the pendency of the proceedings.
On the same day this court signed the annexed judgment ordering that the case be remanded and the prisoner released.
The return of the detective officer, Mr. Juan Quiñones, maintained that the prisoner was held by reason of the order of the Spanish consul and that was his justification for such detention. What we find is that here was a man who was actually in the physical custody of an insular official and his liberty denied him. We do not understand what relation could exist between the Spanish consul and the insular official which would justify the latter in detaining any one a prisoner. The essential idea of a writ of habeas corpus is to prevent a man from being illegally restrained of his liberty.
In the case at bar there was no warrant, or judgment, or decree of any kind of court. He was held apparently without writ of any kind from any authority local or national. It must affirmatively appear when the application for a writ of habeas corptis is made if the person is to be remanded to custody that such prisoner is held by virtue of some competent authority. It is, therefore,’ evident prima facie that this man, not being held by any kind of judicial intervention without warrant of any kind, was by-the principles of the law of habeas corpus in force in this Island, immediately entitled to his liberty. By various sections of the Code certain officers have a right to make arrows upon a crime being *584charged, but there is no suggestion in this case that the prisoner was held by- virtue of such authority.
It was apparently maintained in the court below that the detention of the prisoner did not take place in .the territory of the United States or by the authority of said United States. It is suggested rather than urged in the opinion of that court that foreign vessels in the ports of the United States are foreign territory. The authorities seem to indicate the contrary. (See Cyclopedia of Law and Procedure, vol. 19, p. 60.) Even supposing this to be the. case the fact-remains that at the time that the application for a writ of habeas corpus was made the prisoner was actually and physically at No. 5 Cristo Street, a jail of the detective force of the Grovernment of Porto Bico, and that jail is certainly not Spanish territory. There is no part of this Island which is Spanish territory. If the Spanish consul had taken this man to his own house and held him there it still could not have been maintained that such house partook of the character of extra territoriality. By virtue of-the treaty of July 3, 1902, a consul is exempt from certain things to which the ordinary citizen may -be subjected. For example, a Spanish consul is exempt from taxes or military quarterings and may not be arrested except for a crime or misdemeanor committed against the law of the country to which he is named as he is excluded from the operation of other things obligatory upon citizens. But a consul is not endowed with the extra territoriality that belongs to an ambassador or minister who represents the sovereign of the state from which he is accredited. (See 2 Cyclopedia of Law and Procedure, vol. 2, p. 269.) Therefore, if this man, Juan Alvarez Peña, had been taken to the house of the consul himself'he would not have been in any materially different situation than the one in which he found himself'when he made his application for a writ of habeas corpus. Mention was made at the hearing of the law of extradition. Even supposing that there is an extradition -treaty in force between Spain *585and the United States, there was no, attempt made by the Spanish authorities, so far as the proceedings reveal, to ask for such proceedings. Extradition proceedings are nsnsally begun by application to' some magistrate for the detention of the supposed fugitive, and when the prisoner is finally handed over to the foreign nation such action is done by the authority of the United States itself. It is needless to- enter into this[ (¡matter to any great extent, because the contention is that the petitioner was not subject to the jurisdiction of the local courts; that he was outside of the jurisdiction of such courts. We are aware that this contention does not explicitly -appear in the proceedings, but it is a necessary inference from the opinion of the court below. However, as we have before said, when the prisoner was taken from said boat and put into a local jail he was in all respects subject to the jurisdiction of the local courts, and for these reasons the prisoner was entitled to be released.
Reversed.
Chief Justice Quiñones and Justices Hernández, Figueras and MacLeary concurred.