
91 Cal.App.3d 925 (1979)
154 Cal. Rptr. 476
JOHN DEWITT STEVENSON, Petitioner,
v.
THE SUPERIOR COURT OF SANTA CLARA COUNTY, Respondent; THE PEOPLE, Real Party in Interest.
Docket No. 45917.
Court of Appeals of California, First District, Division Four.
April 16, 1979.
*927 COUNSEL
Sheldon Portman, Public Defender, and C. Randall Schneider, Deputy Public Defender, for Petitioner.
No appearance for Respondent.
George Deukmejian, Attorney General, Jack R. Winkler, Robert H. Philibosian, Chief Assistant Attorneys General, Edward P. O'Brien, Assistant Attorney General, Herbert F. Wilkinson and Ina Levin Gyemant, Deputy Attorneys General, for Real Party in Interest.
OPINION
CHRISTIAN, J.
John Dewitt Stevenson seeks a writ (Pen. Code, § 999a) to restrain respondent superior court from taking any further action in a felony case pending against him other than to dismiss the information. We issue the writ because there was no competent evidence at the preliminary hearing supporting the order of the magistrate holding petitioner for trial.
On April 13, 1978, a complaint was filed in the municipal court charging petitioner with assault with intent to murder (Pen. Code, § 217) and assault with a deadly weapon (Pen. Code, § 245). Both counts arose out of an alleged attack on one Ernesto Munoz Salinas on April 11, 1978.
On April 14, 1978, petitioner was arraigned, but no plea was taken; on motion of his counsel pursuant to Penal Code section 4011.6, a psychiatric report was ordered and the case was continued to April 18, 1978, for arraignment. On that date he pleaded not guilty.
On May 2, 1978, a preliminary hearing was held and petitioner was held to answer on both counts.
An information was filed in superior court, but criminal proceedings were suspended (Pen. Code, § 1368[1]) and the court undertook to *928 determine whether petitioner was competent to stand trial. Petitioner was found to be incompetent and committed to Atascadero State Hospital. On November 1, 1978, petitioner was returned to superior court as competent and remanded to municipal court for a new preliminary hearing.
At the second preliminary hearing, held on November 16, 1978, the People called two witnesses, who testified that the victim, Ernesto Salinas, could not be found. The magistrate then received over objection the testimony of Salinas at the first preliminary hearing (see Evid. Code, § 1290[2]).
At the conclusion of the reading of the former testimony, the magistrate held petitioner to answer; the magistrate also referred petitioner to the superior court under Penal Code section 1368.
When petitioner appeared in superior court for arraignment on a new information, criminal proceedings were again suspended, and new proceedings were instituted to determine petitioner's competency. Petitioner *929 was found competent; he then moved to dismiss the information (Pen. Code, § 995) on the ground he had not been committed on competent evidence. The court denied the motion, and petitioner sought relief in this court.
(1a) Petitioner contends that he was not lawfully held for trial in the superior court when the only evidence at the preliminary hearing was a transcript of testimony taken at a prior preliminary hearing while he was mentally incompetent. Evidence Code section 1291, subdivision (a), permits the use of evidence of former testimony by an unavailable declarant if "[t]he party against whom the former testimony is offered was a party to the action or proceeding in which the testimony was given and had the right and opportunity to cross-examine the declarant with an interest and motive similar to that which he has at the hearing." (Italics added.)
The People point out that petitioner was represented by counsel, who had an opportunity to cross-examine Salinas at the first preliminary hearing. In fact counsel did cross-examine Salinas. The question is whether the right of confrontation is vindicated by such cross-examination when the defendant is mentally incompetent.
In People v. Gibbs (1967) 255 Cal. App.2d 739 [63 Cal. Rptr. 471], the court held that prior testimony of an unavailable witness was inadmissible where the attorney had been appointed only five minutes before his opportunity to cross-examine at the prior hearing and thus "did not have the kind of opportunity needed for investigation and preparation of cross-examination of a witness whose testimony was ultimately to be used at the trial itself.... [¶] Bare existence of an opportunity for cross-examination in a prior proceeding supplies only a limited indicator of the opportunity's adequacy. Pointer v. Texas [(1965) 380 U.S. 400 (13 L.Ed.2d 923, 85 S.Ct. 1065)] holds the opportunity inadequate when the accused has no lawyer. The presence and participation of counsel, however, do not necessarily ensure the opportunity's adequacy. Qualitative factors play a role. The nature of the proceeding; the character of the witness and his connection with the events; the extent and subject of his direct testimony; the time and preparatory opportunities available to the accused and his attorney  these are some of the influential factors." (255 Cal. App.2d at pp. 742, 743.)
Similarly, in People v. Johnson (1975) 46 Cal. App.3d 701 [120 Cal. Rptr. 372], the court reversed a conviction based almost exclusively on the *930 preliminary hearing testimony of a Spanish-speaking witness, admitted at trial on the basis that the witness was unavailable, over a defense showing that there were significant errors in the interpreter's translation of the testimony. The court concluded that no "meaningful opportunity to cross-examine" had existed. (46 Cal. App.3d at p. 704.)
The appropriate test is not merely whether defendant was represented by counsel who had an opportunity to cross-examine the witness at the preliminary hearing. It must be determined whether there was a real opportunity of cross-examination. The test is not met when the defendant is incompetent at the time of the hearing where the testimony is given. (2) "A defendant is entitled to effective assistance of counsel at a preliminary hearing, and counsel cannot effectively represent a client who does not understand the nature of the charges ... or who is unable to cooperate in [the] defense." (Chambers v. Municipal Court (1974) 43 Cal. App.3d 809, 813 [118 Cal. Rptr. 120].) Absent such confrontation and effective representation at the first preliminary hearing, defendant has been denied his substantial rights, and a commitment based on the evidence adduced at that hearing is unlawful. (Cf. Jennings v. Superior Court (1967) 66 Cal.2d 867, 874 [59 Cal. Rptr. 440, 428 P.2d 304].)
The People argue that absent a showing to the contrary by petitioner, it may be presumed that his attorney's cross-examination of Salinas at the first preliminary hearing was "meaningful" and that petitioner's incompetence at that time does not necessarily indicate that he was deprived of his confrontation rights. But the argument depends on speculation. (3) A preliminary hearing that takes place when the defendant is incompetent is conclusively violative of due process, regardless of the extent of cross-examination by counsel or of any other facts in the case. (Chambers v. Municipal Court, supra, 43 Cal. App.3d 809, 813; also see Miller v. Superior Court (1978) 81 Cal. App.3d 132, 136 [146 Cal. Rptr. 253].)
The People suggest that any deficiency in the cross-examination of Salinas may later be cured. It is argued that, "Here the witness, presumably, will be available for incisive cross-examination at the trial." (4) But the right to confrontation is not limited to the trial stage of proceedings. Rather, it extends to any stage when there are witnesses to be questioned. (People v. House (1970) 12 Cal. App.3d 756, 766-767 [90 Cal. Rptr. 831], overruled on other grounds in People v. Beagle (1972) 6 Cal.3d 441, 451-452 [99 Cal. Rptr. 313, 492 P.2d 1]; Pen. Code, §§ 686, subd. 3, 977, subd. (b).) (1b) Thus, petitioner's fundamental right to *931 confront the witness against him was violated by the magistrate's ruling at the second preliminary hearing receiving in evidence Salinas' testimony from the first preliminary hearing, which was held when petitioner was incompetent.
A writ will issue as prayed.
Rattigan, Acting P.J., and Poche, J., concurred.
A petition for a rehearing was denied May 8, 1979.
NOTES
[1]  Penal Code section 1368:

"(a) If, during the pendency of an action and prior to judgment, a doubt arises in the mind of the judge as to the mental competence of the defendant, he shall state that doubt in the record and inquire of the attorney for the defendant whether, in the opinion of the attorney, the defendant is mentally competent. If the defendant is not represented by counsel, the court shall appoint counsel. At the request of the defendant or his counsel or upon its own motion, the court shall recess the proceedings for as long as may be reasonably necessary to permit counsel to confer with the defendant and to form an opinion as to the mental competence of the defendant at that point in time.
"(b) If counsel informs the court that he believes the defendant is or may be mentally incompetent, the court shall order that the question of the defendant's mental competence is to be determined in a hearing which is held pursuant to Sections 1368.1 and 1369. If counsel informs the court that he believes the defendant is mentally competent, the court may nevertheless order a hearing. Any hearing shall be held in the superior court.
"(c) Except as provided in Section 1368.1, when an order for a hearing into the present mental competence of the defendant has been issued, all proceedings in the criminal prosecution shall be suspended until the question of the present mental competence of the defendant has been determined.
"If a jury has been impaneled and sworn to try the defendant, the jury shall be discharged only if it appears to the court that undue hardship to the jurors would result if the jury is retained on call.
"If the defendant is declared mentally incompetent, the jury shall be discharged."
[2]  Evidence Code section 1290: "As used in this article, `former testimony' means testimony given under oath in:

"(a) Another action or in a former hearing or trial of the same action:
"(b) A proceeding to determine a controversy conducted by or under the supervision of an agency that has the power to determine such a controversy and is an agency of the United States or a public entity in the United States;
"(c) A deposition taken in compliance with law in another action; or
"(d) An arbitration proceeding if the evidence of such former testimony is a verbatim transcript thereof."
