
15 Cal.App.3d 290 (1971)
93 Cal. Rptr. 119
In re HOOD P. SCRUGGS on Habeas Corpus
Docket No. 5998.
Court of Appeals of California, Third District.
February 16, 1971.
*292 COUNSEL
Robert F. O'Neal, under appointment by the Court of Appeal, for Petitioner.
Thomas C. Lynch and Evelle J. Younger, Attorneys General, Edward A. Hinz, Jr., and Carol Hunter, Deputy Attorneys General, for Respondent.
OPINION
BRAY, J.[*]
This is a petition for a writ of habeas corpus.

QUESTION PRESENTED
The controlling question is whether petitioner may now show that he pleaded guilty to a crime which he did not commit.

RECORD
Petitioner is confined in Folsom Prison on a judgment of conviction, after plea of guilty, of violation of Welfare and Institutions Code section 3002. In his petition he alleges, (a) that he pleaded guilty without effective counsel and while suffering narcotic (heroin) withdrawal symptoms rendering him incompetent to understand the nature of the charge against him and to understandingly and intelligently plead guilty to it; (b) that his confinement is unlawful in that the statute he was convicted of violating did not prohibit his conduct and therefore he was convicted of a crime which he did not commit.[1]
October 6, 1966, petitioner was arrested and charged with violation of section 11500 of the Health and Safety Code (possession of heroin). January 4, 1967, application was made pursuant to section 3100.6 of the Welfare and Institutions Code for petitioner's temporary detention by the Sheriff's Department of Los Angeles County as a drug addict.[2] Thereafter, proceedings were had pursuant to section 3100 of the Welfare and Institutions Code, resulting in a civil petition under that section being filed alleging that petitioner was in need of care, supervision and treatment for drug addiction. Petitioner was ordered detained in the Los *293 Angeles County jail infirmary and the public defender was appointed to represent him. The hearing of the petitioner was had on January 26, 1967. During the hearing, petitioner unauthorizedly left the courtroom but was captured in the corridor outside the courtroom. On January 30, the court found petitioner to be a drug addict within the meaning of Welfare and Institutions Code section 3100. It committed him to the Rehabilitation Center at Corona, where he was taken by the sheriff.
On March 2, 1967, an information was filed charging petitioner with escape in violation of Welfare and Institutions Code section 3002, a felony. It charged petitioner with the crime of escape from custody of a deputy sheriff, "while charged with a crime, to wit, 3100, Welfare and Institutions Code."
Petitioner was arraigned on this charge and the public defender appointed to represent him. On March 8, 1967, petitioner pleaded guilty to the offense charged  violation of section 3002 of the Welfare and Institutions Code and in due time was sentenced to state prison for the term prescribed by law.
(1a) Petitioner committed no crime. Section 3002 provides in pertinent part, "Every person committed pursuant to this chapter or former Chapter 11 (commencing with section 6399) of Title 7 of the Penal Code who escapes or attempts to escape from lawful custody is guilty of a crime punishable by imprisonment in the state prison for not exceeding seven years...." (Italics ours.)
A mere reading of the section establishes that in order to violate the section, the person who escapes must have been committed pursuant to the statutes referred to in the section. It is conceded that while petitioner was before the court for determination of whether he should be committed, when he left the courtroom he had not been committed.
Moreover, the information states that petitioner escaped from custody "while charged with a crime, to wit, 3100, Welfare and Institutions Code." That section provides no crime. It simply provides that a person addicted to the use of narcotics or in danger of becoming so addicted may report to the district attorney, who, when there is probable cause, may petition the superior court for commitment to the Director of Corrections for confinement in the narcotic detention, treatment and rehabilitation facility.
(2) The Attorney General concedes the above, but contends that because petitioner was represented by counsel when he pleaded guilty to a crime he did not commit, he may not now obtain relief. He relies upon In re Tahl (1969) 1 Cal.3d 122 [81 Cal. Rptr. 577, 460 P.2d 449], which held in effect that prior to Boykin v. Alabama (1969) 395 U.S. *294 238 [23 L.Ed.2d 274, 89 S.Ct. 1709], where a defendant advises with counsel before pleading guilty, his plea cannot be considered involuntary. The weakness of this argument lies in the fact that for many years the California courts have recognized that when, through ignorance or omission, defense counsel causes or permits the loss or lack of a crucial defense, this is in effect a denial of counsel, infecting the conviction and is sometimes alone ground for reversal. (In re Williams (1969) 1 Cal.3d 168, 174-175 [81 Cal. Rptr. 784, 460 P.2d 984].) There, the defendant's counsel permitted the defendant to enter a bargain plea of guilty to a crime which he did not commit. On habeas corpus the Supreme Court held that he was thereby denied his right to effective assistance of counsel. (See also, People v. McDowell (1968) 69 Cal.2d 737, 746-750 [73 Cal. Rptr. 1, 447 P.2d 97]; and People v. Ibarra (1963) 60 Cal.2d 460, 464 [34 Cal. Rptr. 863, 386 P.2d 487].) (3) In re Greenfield (1970) 11 Cal. App.3d 536, 541 [89 Cal. Rptr. 847], held that where, through the ineffectiveness of counsel, a defendant is deprived of valid defenses, the resulting judgment of guilt will be reversed on appeal or vacated by a writ of habeas corpus. This case answers the Attorney General's contention that petitioner's failure to appeal from his conviction denies him the right to raise the issue by habeas corpus and also the Attorney General's contention that petitioner is precluded from raising the issue now because he did not follow the procedure of rule 31, subdivision (d), California Rules of Court, and section 1237.5 of the Penal Code, providing a method of appeal from a plea of guilty. Moreover, petitioner satisfactorily explains his delay in raising the issue after more than three years' confinement in prison. He was given no medical treatment in prison; was suffering for a long period of time with narcotic withdrawal symptoms; was never advised of his right to appeal nor of the requirements of section 1237.5. After recovering from withdrawal symptoms while at California Institution for Men at Chino, he began to make inquiries as to his rights and status; and it was not until he was transferred to state prison that he learned he had pleaded guilty to a crime which he did not commit.
Where, as here, the record shows without doubt that a defendant has pleaded guilty to a crime which he did not commit, the courts should hesitate to apply technical rules to prevent such defendant from obtaining relief. (4) As said in In re Cameron (1968) 68 Cal.2d 487, 491 [67 Cal. Rptr. 529, 439 P.2d 633], "Habeas corpus is available to challenge violations of constitutional rights relevant to the determination of guilt if the petitioner presents an adequate excuse for failing to invoke his remedy by appeal."
(1b) The Attorney General would have us disregard the fact that in *295 order to constitute an escape under section 3002, Welfare and Institutions Code, the person escaping must have been "committed" and to construe that section to apply to a person "who has been involuntarily detained under order of court." To do so would constitute judicial legislation proscribed by Code of Civil Procedure section 1858.
The writ is granted and petitioner is discharged from custody.
Pierce, P.J., and Regan, J., concurred.
NOTES
[*]   Retired Presiding Justice of the Court of Appeal sitting under assignment by the Chairman of the Judicial Council.
[1]  Petitioner heretofore filed in the Los Angeles Superior Court a petition for coram nobis, and one for habeas corpus, in that court and one in the Supreme Court and one in the federal court. All the petitions were denied, that in the federal court on the ground that petitioner had not exhausted his state remedies.
[2]  A prior application had been made but not acted upon.
