
64 Cal.2d 760 (1966)
In re RONALD WAYNE BEATY on Habeas Corpus.
Crim. No. 9767. 
Supreme Court of California. In Bank.  
June 8, 1966.
 Ronald Wayne Beaty, in pro. per., and Andrew L. Tobia, under appointment by the Supreme Court, for Petitioner.
 Thomas C. Lynch, Attorney General, Doris H. Maier, Assistant Attorney General, and Raymond M. Momboisse, Deputy Attorney General, for Respondent.
 TRAYNOR, C. J.
 In this habeas corpus proceeding petitioner seeks his release from the state prison at Folsom on the ground that the assistance given him by appointed counsel was so inadequate as to deprive him of his constitutional right to counsel. (Gideon v. Wainwright, 372 U.S. 335 [83 S.Ct. 792, 9 L.Ed.2d 799, 93 A.L.R.2d 733].)
 On August 4, 1964, petitioner was arraigned before the Municipal Court of the Anaheim-Fullerton Judicial District on a charge of robbery. He was informed of his legal rights and was given a copy of the complaint. The court appointed the public defender to represent him. On August 10, 1964, petitioner appeared with a deputy public defender, waived preliminary hearing, and entered a plea of guilty.
 Petitioner appeared in the Superior Court of Orange County without counsel on August 14, 1964, for proceedings on his certified plea of guilty. The court appointed another deputy public defender present in the courtroom to represent him. The court then found that the robbery was of the first degree and pursuant to petitioner's request for immediate sentencing ordered him confined to state prison for the term prescribed by law.
 Subsequently petitioner sought a writ of coram nobis in the Superior Court of Orange County to have the judgment set aside. The court appointed counsel to represent him and held evidentiary hearings on April 30, 1965, and May 5, 1965. The *762 court found that there was no mistake on the part of petitioner in entering the plea of guilty that he could not have discovered through the exercise of due diligence and therefore denied the petition. The evidence at the hearings prompted the court to comment, however, that petitioner was not adequately represented by counsel in the proceedings leading to his conviction for robbery and that his proper remedy was habeas corpus. It declined to treat the petition as one for habeas corpus on the ground that it lacked jurisdiction to grant such relief to a petitioner confined in Orange County only temporarily for the purpose of a coram nobis proceeding.
 Petitioner thereupon filed petitions for writs of habeas corpus in the Superior Court of Sacramento County and in the District Court of Appeal for the Third Appellate District. Both petitions were denied.
 The record of the hearings in the coram nobis proceeding is before the court. Respondent has submitted an affidavit by the deputy public defender who represented petitioner at the August 10 hearing, setting forth additional facts that influenced him to believe that the guilty plea was in petitioner's best interests. The report of the investigator who interviewed petitioner for the public defender's office has also been submitted. The parties have stipulated that the record of the coram nobis proceeding, the attorney's affidavit, and the investigator's report are a sufficient record for this court to determine whether petitioner was adequately represented by counsel.
 Petitioner and a codefendant were arrested on August 2, 1964.petitioner was interrogated by police officers at the Garden Grove police station, but refused to answer questions regarding the offense and was subsequently lodged in the Orange County jail. After he had been arraigned but before he met the deputy public defender assigned to represent him, petitioner signed a confession prepared for him by a Garden Grove police officer.
 The preliminary hearing was scheduled for August 7, 1964.petitioner did not meet his counsel until that date. On August 6, 1964, the public defender's investigator interviewed petitioner in the Orange County jail and obtained a statement of the facts surrounding the offense, the arrest, and the police interrogation. The investigator prepared a report of this interview for the deputy public defender who was to represent petitioner. The report stated that charges of kidnaping, violation of the Dangerous Weapons' Control Law, and a robbery *763 in Long Beach, as well as a federal charge of possessing a sawed-off shotgun, were also pending against petitioner. The investigator reported that petitioner claimed that he had been physically abused at the Garden Grove police station when he refused to stand in the lineup and that he made his confession after the police told him that he would not be prosecuted for the robbery in Long Beach if he confessed the Orange County robbery.petitioner testified at the coram nobis hearings that he requested permission to see an attorney when he was at the Garden Grove police station and that the request was denied. There is no mention of such a request and denial in the investigator's report.
 Petitioner's attorney had received the investigator's report before he interviewed petitioner on August 7th and had also discussed the case with the deputy district attorney assigned to prosecute petitioner. This discussion and the information provided by the investigator led the attorney to believe that the district attorney regarded petitioner as a dangerous criminal and that the aggravated nature of the offense and petitioner's conduct would result in a charge of kidnaping if the matter were not handled with dispatch. In the attorney's opinion petitioner's arrest and the search incidental thereto were legal and any rough treatment of petitioner was caused by his behavior at the Garden Grove police station.
 The attorney's interview with petitioner took place in the holdover tank of the Anaheim-Fullerton Municipal Court.petitioner, his codefendant, and several other persons to be represented by the same attorney were among the many defendants held there awaiting courtroom appearances.petitioner testified that the meeting was of approximately five minutes' duration. The attorney testified at the coram nobis proceeding that it was two minutes. He states in his affidavit that he now remembers it was longer but does not state how long. He interviewed petitioner and the codefendant together. He explained the serious nature of the charge and told petitioner that he was aware of other pending charges. He said that he would attempt to arrange the "package deal" that both defendants wanted whereby petitioner would plead guilty to one charge of robbery in Orange County and the district attorney would not press kidnaping charges, and the Los Angeles County robbery charge would be dismissed if petitioner were to plead guilty and receive a prison term.petitioner agreed to this procedure. They discussed bail, and the *764 attorney advised defendants to do nothing that would cause the district attorney to revoke the offer to accept a plea of guilty to robbery. The attorney thereupon obtained a continuance until August 10, 1964.petitioner did not see the attorney again until that day. By that time the arrangements to have petitioner plead guilty had been completed. The preliminary examination was waived, petitioner entered a plea of guilty, and his association with his counsel ended. He did not see this attorney again.
 Petitioner contends that the attorney's failure to discuss possible defenses with him foreclosed rights made available to him under the decision of the United States Supreme Court in Massiah v. United States, 377 U.S. 201 [84 S.Ct. 1199, 12 L.Ed.2d 246], and Escobedo v. Illinois, 378 U.S. 478 [84 S.Ct. 1758, 12 L.Ed.2d 977].
 [1] To justify relief on the ground that counsel was inadequate, it must appear that the trial was reduced to a farce or sham through the attorney's lack of competence, diligence, or knowledge of law. (People v. Ibarra, 60 Cal.2d 460, 464 [34 Cal.Rptr. 863, 386 P.2d 487].) [2] If a crucial defense is withdrawn from the case through the failure of counsel to investigate carefully all defenses of fact and law, the defendant has not received adequate representation. (People v. Mattson, 51 Cal.2d 777, 790-791 [336 P.2d 937].) [3] No such failure appears here.
 The record shows that each of the possible defenses now suggested by petitioner was investigated and considered by his attorney. The attorney was apprised of petitioner's claims through the investigator's report. From the description of the arrest given by petitioner and his codefendant, the attorney was able to determine that there was probable cause for the arrest and that the search incident to the arrest was justified and reasonable. A tavern near the scene of the arrest had been robbed a few minutes prior thereto. There were several witnesses to the robbery, and a description of the robbers and their car had been broadcast. Near the scene of the robbery officers stopped a car driven by petitioner and his codefendant. Petitioner's codefendant stepped from the car with shotgun in hand while the officers were talking to petitioner. These facts adequately support the conclusion of the attorney that there was no basis for a claim that the arrest and the search of the car were unconstitutional.
 The allegation that petitioner was mistreated by the Garden Grove police presents no issue that might form the basis of a *765 defense to the robbery charge.petitioner concedes that he made no statement to the police at this time.
 Petitioner admitted his participation in the robbery to the public defender's investigator. He also told the investigator that he had "copped- out" to the police after being told that if he did so Los Angeles County authorities would not prosecute him for the robbery in Long Beach. In assessing the possible defense that the confession was in response to promises of leniency or immunity and was therefore involuntary, petitioner's attorney considered the fact that it was petitioner who requested the officer to whom he confessed to come to the jail and thus apparently took the initiative in suggesting the "package deal" whereby other charges would be dropped in exchange for his confession. In the light of these facts and petitioner's past experience with the law, his attorney could reasonably conclude that it was unlikely that the confession would be excluded as involuntary and that, even if it were, there was ample other evidence to secure a conviction.
 [4] The decision to plead guilty or not guilty was for petitioner to make. (Pen. Code,  1018; In re Rose, 62 Cal.2d 384, 390 [42 Cal.Rptr. 236, 398 P.2d 428].) He was not deprived of effective assistance of counsel in making that decision when his attorney acquiesced in it after considering the merits of possible defenses and the substantial possibility that more serious charges would be successfully prosecuted if petitioner did not plead guilty.
 The order to show cause is discharged and the writ of habeas corpus is denied.
 McComb, J., Peters, J., Tobriner, J., Peek, J., Mosk, J., and Burke, J., concurred.
