Appellant was charged with murder and several other offenses. Two psychiatrists were appointed to evaluate appellant’s competency; the trial court found appellant incompetent and ordered his commitment. After a year of confinement, he was returned for trial and convicted. At a separate sanity trial, the psychiatrists who examined appellant for the 1368 proceedings were allowed to testify regarding statements he made during competency evaluations and during his hospitalization. In conjunction with his appeal, appellant filed a petition for writ of habeas corpus, claiming that counsel’s failure to object to the inadmissible expert testimony at the sanity phase resulted in prejudicial error. The appellate court agreed. Appellant’s statements to the psychiatrists are subject to the judicially declared rule of immunity adopted and reaffirmed in several decisions of the California Supreme Court. Their testimony at the sanity phase was inadmissible. The admission of otherwise inadmissible testimony occurred as a result of trial counsel’s error, and there was a reasonable probability that but for the error the result would have been more favorable to appellant. Therefore, the petition was granted and the matter remanded for a new sanity trial.