
167 Cal.App.4th 37 (2008)
JALEH WILKINSON, Plaintiff and Appellant,
v.
GARRETT JASON ZELEN, Defendant and Respondent.
No. B200074.
Court of Appeals of California, Second District, Division Five.
September 25, 2008.
*39 Procopio, Cory, Hargreaves & Savitch, Anthony J. Dain; Law Offices of Eric R. Larson and Eric R. Larson for Plaintiff and Appellant.
Pollard Mavredakis Cranert Crawford & Stevens and Joyce L. Mavredakis for Defendant and Respondent.
OPINION
KRIEGLER, J.
Wiley v. County of San Diego (1998) 19 Cal.4th 532 [79 Cal.Rptr.2d 672, 966 P.2d 983] (Wiley) held that factual innocence is an *40 element of a legal malpractice action stemming from representation in an underlying criminal trial. Later, Coscia v. McKenna & Cuneo (2001) 25 Cal.4th 1194 [108 Cal.Rptr.2d 471, 25 P.3d 670] (Coscia) held that the legal malpractice plaintiff must obtain postconviction exoneration in the underlying case in order to establish the element of factual innocence required by Wiley. Addressing an issue left open in Sangha v. LaBarbera (2006) 146 Cal.App.4th 79 [52 Cal.Rptr.3d 640] (Sangha), we now hold that a legal malpractice plaintiff must prove factual innocence and exoneration as to all transactionally related offenses comprising the basis for the underlying criminal proceeding in order to maintain a malpractice action.
Plaintiff and appellant Jaleh Wilkinson was convicted by jury of one felony and two misdemeanors while represented by defendant and respondent Garrett Jason Zelen and the Law Offices of Garrett J. Zelen (Zelen). The judgment was affirmed on direct appeal by the California Supreme Court, but an order to show cause returnable in the trial court was issued by the Court of Appeal on Wilkinson's petition for writ of habeas corpus, which alleged that Zelen provided incompetent representation at trial. The prosecution did not oppose the habeas corpus petition, which was granted, and conviction on all three counts was vacated. Pursuant to a plea bargain, Wilkinson then entered no contest pleas to two misdemeanors.
Wilkinson filed the instant action for legal malpractice and breach of contract against Zelen.[1] The trial court sustained Zelen's demurrer to the operative first amended complaint (FAC) without leave to amend, on the basis that Wilkinson could not plead she was factually innocent and she was not exonerated by postconviction relief, as required by Coscia and Wiley. We hold the demurrer was properly sustained without leave to amend.

Allegations of the FAC
Wilkinson alleged she retained Zelen to represent her in a criminal action, in which she was convicted by jury in October 2000 of all chargesfelony battery on a custodial officer (Pen. Code, § 243.1), misdemeanor driving under the influence (Veh. Code, § 23152, subd. (a)) and failing to stop at the scene of an accident (Veh. Code, § 20002, subd. (a)). Wilkinson was immediately remanded to custody following the verdict and ultimately sentenced to 180 days in county jail, where she suffered severe beatings by other inmates. The convictions were due to the incompetence of Zelen in preparing and assessing the case, attempting to reach a settlement with the prosecutor, and failing to communicate settlement offers. As a result of the conviction, *41 Wilkinson was terminated from employment with a bank and her petition for naturalization, which had been previously approved, was subsequently denied and revoked.
Wilkinson filed a direct appeal and a petition for writ of habeas corpus in the Court of Appeal. The Court of Appeal found a prima facie case for relief based on incompetence of trial counsel and ordered further proceedings in the superior court, where the court exonerated Wilkinson of all charges on which she was convicted. The FAC alleged that Wilkinson is factually innocent of all charges of which she was convicted.

Zelen's Demurrer and Wilkinson's Opposition
Zelen demurred to the FAC on the ground Wilkinson failed to allege factual innocence[2] and could not make such an allegation because of a lack of substantial evidence. Wilkinson filed an opposition to the demurrer, arguing that she did specifically allege factual innocence. She contended her convictions were reversed as a result of the habeas corpus petition alleging incompetence of counsel, the felony conviction was the gravamen of the malpractice action, and that charge was dismissed and she entered a plea to a violation of Penal Code section 148. Wilkinson also argued she can demonstrate actual innocence of the two charges to which she plead no contest.
In connection with the demurrer, Zelen and Wilkinson both filed requests for judicial notice of various records from the underlying criminal action against Wilkinson, her appeal, and proceedings on her petition for writ of habeas corpus.[3] The judicially noticed records reveal the following.
On Wilkinson's direct appeal from her criminal convictions, the Court of Appeal held that the punishment provision of Penal Code section 243.1 violated the constitutional guarantee of equal protection of the law, with one justice dissenting. The Court of Appeal also held that Wilkinson was entitled to an evidentiary hearing regarding the admissibility of polygraph evidence. On the habeas corpus petition, the Court of Appeal concluded Wilkinson had alleged a prima facie case for relief based on ineffective assistance of counsel and issued an order to show cause returnable in the trial court.
The California Supreme Court granted the Attorney General's petition for review on Wilkinson's direct appeal. No petition for review was filed as to *42 Wilkinson's habeas corpus petition. The Supreme Court reversed the judgment of the Court of Appeal, holding that the punishment provision of Penal Code section 243.1 does not violate equal protection, and Wilkinson was not entitled to an evidentiary hearing on the admissibility of her proffered polygraph evidence in view of Evidence Code section 351.1. (People v. Wilkinson (2004) 33 Cal.4th 821 [16 Cal.Rptr.3d 420, 94 P.3d 551].) The Supreme Court expressed no opinion on the habeas corpus claim as it was not within the scope of the grant of review. (Id. at pp. 829, fn. 1, 852.)
The habeas corpus petition was then addressed in the trial court pursuant to the Court of Appeal's order to show cause. The prosecution did not file a return to the order to show cause. The prosecutor orally stated she did not oppose relief and was interested in disposing of the case through a negotiated settlement with Wilkinson. With no opposition, the trial court granted Wilkinson's habeas corpus petition, finding the allegations in the petition were "sufficiently made out." The convictions on all three counts the felony and two misdemeanorswere vacated. As part of a negotiated case settlement, Wilkinson entered no contest pleas to the original Vehicle Code section 23152, subdivision (a) charge, as well as an added misdemeanor violation of Penal Code section 148, subdivision (a)(1). The two remaining countsthe felony violation of Penal Code section 243.1 and misdemeanor violation of Vehicle Code section 20002, subdivision (a)were dismissed on the People's motion.
Probation was granted on the two misdemeanor counts. The trial court immediately found Wilkinson had successfully completed probation, which was ordered terminated. The convictions were ordered "expunged" under Penal Code section 1203.4.

Ruling on the Demurrer and Judgment
The trial court sustained Zelen's demurrer without leave to amend. The court indicated Wilkinson had not been found innocent of all charges relating to the action. The court rejected the argument that the felony charge of battery on a custodial officer could be separated from the misdemeanor charges, as all charges arose from the same incident. The court was of the view Wilkinson failed to show she was factually innocent of all the charges and that she had been exonerated. Judgment was entered in favor of Zelen. Wilkinson filed a timely notice of appeal.

DISCUSSION
(1) Wilkinson argues the trial court erred in sustaining the demurrer to the first amended complaint. She reasons that the postconviction relief, based on ineffective assistance of counsel at trial, satisfies the pleading requirement *43 that a legal malpractice action stemming from a criminal case cannot be pursued without proof of actual innocence. Wilkinson contends her legal malpractice action is not barred by her no contest pleas to two misdemeanors. She also contends that she should be allowed leave to amend if the order sustaining the demurrer is affirmed. We hold the demurrer was properly sustained, as the judicially noticed court records demonstrate that Wilkinson cannot establish factual innocence or exoneration, and leave to amend was properly denied.

Standard of Review
"On appeal from a judgment dismissing an action after sustaining a demurrer without leave to amend, the standard of review is well settled. We give the complaint a reasonable interpretation, reading it as a whole and its parts in their context. (Zelig v. County of Los Angeles (2002) 27 Cal.4th 1112, 1126 [119 Cal.Rptr.2d 709, 45 P.3d 1171].) Further, we treat the demurrer as admitting all material facts properly pleaded, but do not assume the truth of contentions, deductions or conclusions of law. (Ibid.; Aubry v. Tri-City Hospital Dist. (1992) 2 Cal.4th 962, 966-967 [9 Cal.Rptr.2d 92, 831 P.2d 317] (Aubry).) When a demurrer is sustained, we determine whether the complaint states facts sufficient to constitute a cause of action. (Zelig, supra, 27 Cal.4th at p. 1126.) And when it is sustained without leave to amend, we decide whether there is a reasonable possibility that the defect can be cured by amendment: if it can be, the trial court has abused its discretion and we reverse. (Ibid.)" (City of Dinuba v. County of Tulare (2007) 41 Cal.4th 859, 865 [62 Cal.Rptr.3d 614, 161 P.3d 1168].) In ruling on a demurrer, the court may "`take judicial notice of a party's earlier pleadings and positions as well as established facts from both the same case and other cases. . . .' [Citations.]" (McKell v. Washington Mutual, Inc. (2006) 142 Cal.App.4th 1457, 1491 [49 Cal.Rptr.3d 227].)

Supreme Court Description of the Facts in the Underlying Action
As noted above, the California Supreme Court granted review of the decision of the Court of Appeal on Wilkinson's direct appeal. The following is the Supreme Court's summary of the facts from Wilkinson's criminal trial.
"At trial, the prosecution presented evidence that, in the early morning hours of February 27, 1999, a motorist observed defendant driving erratically on a street in the City of Santa Monica. Defendant's vehicle crossed over the center divider, struck a parked car, and continued down the street, swerving between lanes. Defendant eventually stopped her car at a curb and placed her head on the front passenger seat. After the motorist telephoned the police, officers responded and tapped on the window of defendant's parked car, *44 whereupon defendant looked at one of the officers and drove off. The police gave chase for three blocks before defendant stopped. Defendant, who smelled strongly of alcohol and exhibited slurred speech, indicated she had consumed some drinks but not many. She could not complete a field sobriety test and did not respond when told she was required to submit to a blood or breath test for alcohol.
"Officers transported defendant to the police station. She was belligerent during booking and resisted a patsearch. At one point, defendant grabbed a custodial officer's arm with both hands, causing a visible welt. When taken to a holding cell, defendant charged at an officer and yelled, kicked, and banged at the door. After the police reminded defendant that she would have to submit to a blood or breath test, defendant covered her ears, stated `I can't hear you,' and began running around inside the cell. An officer testified defendant appeared to be under the influence of alcohol but not of drugs.
"Defendant testified in her own defense as follows. On the night in question, defendant, a bank vice-president, went to a bar, where she met a man who offered to buy her a drink. She accepted and eventually consumed two glasses of wine. The man invited defendant to dinner, and they agreed to meet at a Santa Monica restaurant. At the restaurant, defendant consumed three alcoholic beverages over the course of three hours while she waited for the man, but he never arrived. She left her drink several times to use the restroom and to smoke a cigarette outside. She eventually left the restaurant, driving away without feeling any signs of intoxication. The next thing she remembered was waking up in jail, with no recollection of her encounter with the officers. After her release from custody, defendant filed a police complaint alleging she had been drugged.
"A toxicologist, testifying on behalf of the defense, expressed the opinion that on the night in question defendant was under the influence of alcohol and gamma hydroxy butyrate (hereafter GHB), commonly known as a `date rape' drug, basing his opinion on a review of the police report and a videotape of defendant's conduct in the holding cell. GHB depresses the nervous system, exaggerates the effects of alcohol, and may cause drowsiness and memory loss. Depending upon a person's personality, the drug may make a person more emotional and combative. The toxicologist also suggested that if defendant was not under the influence of GHB, she must have been visibly drunk when she left the restaurant in order for her to exhibit the effects of intoxication so long after her last drink. A City of Concord police officer, testifying for the defense as a drug recognition expert, stated that defendant's symptoms appeared much more severe than what would be expected of someone who had consumed five alcoholic drinks over the course of several hours. [¶] . . . [¶]
*45 "The jury convicted defendant as charged, and the trial court placed defendant on formal probation for three years." (People v. Wilkinson, supra, 33 Cal.4th at pp. 828-829.)

The Requirement of Factual Innocence
(2) Factual innocence is an element of a legal malpractice cause of action stemming from representation in a criminal action. "The failure to provide competent representation in a civil or criminal case may be the basis for civil liability under a theory of professional negligence. In a legal malpractice action arising from a civil proceeding, the elements are (1) the duty of the attorney to use such skill, prudence, and diligence as members of his or her profession commonly possess and exercise; (2) a breach of that duty; (3) a proximate causal connection between the breach and the resulting injury; and (4) actual loss or damage resulting from the attorney's negligence. (Budd v. Nixen (1971) 6 Cal.3d 195, 200 [98 Cal.Rptr. 849, 491 P.2d 433]; Schultz v. Harney (1994) 27 Cal.App.4th 1611, 1621 [33 Cal.Rptr.2d 276].) In a legal malpractice case arising out of a criminal proceeding, California, like most jurisdictions, also requires proof of actual innocence. (Wiley v. County of San Diego, supra, 19 Cal.4th at p. 545.)" (Coscia, supra, 25 Cal.4th at pp. 1199-1200.) "If the defendant has in fact committed a crime, the remedy of a new trial or other relief is sufficient reparation in light of the countervailing public policies and considering the purpose and function of constitutional guaranties." (Wiley, supra, 19 Cal.4th at p. 543.)
(3) The court in Wiley explained that safeguards built into the criminal law systemincluding proof beyond a reasonable doubt, the exclusionary rule, and the availability of postconviction reliefdistinguish malpractice actions relating to criminal defendants from those involving parties to civil litigation, where a simple "but-for" test of causation is sufficient. "In the criminal malpractice context, by contrast, a defendant's own criminal act remains the ultimate source of his predicament irrespective of counsel's subsequent negligence. Any harm suffered is not `only because of' attorney error but principally due to the client's antecedent criminality." (Wiley, supra, 19 Cal.4th at p. 540.)
As a result, postconviction relief is often sufficient to afford a criminal defendant what he or she otherwise would have received if competent representation had been provided, including "dismissal of the charges, a reduced sentence, [or] an advantageous plea bargain. . . . If the defendant has in fact committed a crime, the remedy of a new trial or other relief is sufficient reparation in light of the countervailing public policies and considering the purpose and function of constitutional guaranties." (Wiley, supra, 19 Cal.4th at p. 543.)
*46 Wilkinson cannot allege factual innocence under Wiley. To the contrary, she entered no contest pleas to two misdemeanors in order to compromise the charges which resulted in her conviction by jury, a result inconsistent with factual innocence in that "defendant has in fact committed a crime . . . ." (Wiley, supra, 19 Cal.4th at p. 543.) Moreover, Wilkinson obtained the type of postconviction relief envisioned by Wiley as sufficient to cure the harm of incompetent representation, since the trial court granted her habeas corpus petition and Wilkinson received a more favorable disposition that did not include a felony. The postconviction relief obtained by Wilkinson was sufficient to cure the harm, in that she was able to successfully seek "dismissal of the charges, a reduced sentence, [or] an advantageous plea bargain." (Id. at pp. 542-543.)
It bears emphasis that no court has ever suggested that Wilkinson is factually innocent of any of the charged offenses, including the felony battery on a custodial officer. To the contrary, she was convicted by a jury and her conviction as to all counts was affirmed on appeal. Her habeas corpus petition did not raise an issue of factual innocence, but was based on constitutionally inadequate representation by Zelen. After obtaining relief by her habeas corpus petition, Wilkinson voluntarily entered no contest pleas to two misdemeanors, one of which was part of the original judgment in the criminal action, and both were based on the same course of conduct for which she was originally charged. Given this record, the trial court did not err in sustaining the demurrer on the basis Wilkinson could not establish factual innocence.

The Requirement of Exoneration
(4) In Coscia, the Supreme Court addressed an issue left open in Wiley: "whether a former criminal defendant must obtain exoneration by postconviction relief as a prerequisite to obtaining relief for legal malpractice." (Coscia, supra, 25 Cal.4th at p. 1197.) Coscia plead guilty to one count of conspiracy to violate federal securities laws. He later brought a malpractice action, but the trial court sustained a demurrer without leave to amend. Coscia argued he should have been afforded leave to amend to allege that he plead guilty although he was factually innocent. The Court of Appeal reversed the order sustaining the demurrer, concluding "that a plaintiff in a criminal malpractice action who pleaded guilty to the underlying offense is not collaterally estopped from proving actual innocence." (Coscia, supra, at p. 1199.) The Supreme Court granted review and reversed the Court of Appeal, holding "exoneration by postconviction relief is a prerequisite to recovery for legal malpractice arising out of a criminal proceeding . . . ." (Ibid.; see also Redante v. Yockelson (2003) 112 Cal.App.4th 1351, 1357 [6 Cal.Rptr.3d 10].)
*47 Separate and apart from Wilkinson's failure to establish factual innocence under Wiley, the decision in Coscia serves as an independent bar to Wilkinson's action for legal malpractice, as she did not obtain "exoneration" by her habeas corpus petition. "As discussed, public policy considerations require that only an innocent person wrongly convicted be deemed to have suffered a legally compensable harm. Unless a person convicted of a criminal offense is successful in obtaining postconviction relief, the policies reviewed in Wiley preclude recovery in a legal malpractice action." (Coscia, supra, 25 Cal.4th at p. 1201.) "For all these reasons, we conclude that a plaintiff must obtain postconviction relief in the form of a final disposition of the underlying criminal casefor example, by acquittal after retrial, reversal on appeal with directions to dismiss the charges, reversal followed by the People's refusal to continue the prosecution, or a grant of habeas corpus reliefas a prerequisite to proving actual innocence in a malpractice action against former criminal defense counsel." (Id. at p. 1205, fn. omitted.)
The Coscia requirement of exoneration was applied in Sangha to a situation close, but not identical, to that presented in the instant case. While represented by LaBarbera, Sangha plead guilty to felony vandalism in exchange for dismissal of a criminal threats charge. He later obtained new counsel, who successfully had the plea set aside with the prosecutor's stipulation. Sangha then entered a guilty plea to misdemeanor vandalism, a lesser included offense to the felony vandalism charge. Sangha was placed on informal probation and 41 days later, the trial court granted Sangha's petition to expunge the misdemeanor conviction under Penal Code section 1203.4. Sangha then sued LaBarbera for legal malpractice, alleging negligence in the investigation and handling of the action resulting in the felony plea, and further alleging factual innocence of the felony charge. (Sangha, supra, 146 Cal.App.4th at p. 83.)
The trial court granted LaBarbera's summary judgment motion on two grounds: Sangha could not establish factual innocence, and he failed to show postconviction exoneration as required by Coscia. (Sangha, supra, 146 Cal.App.4th at pp. 83-84.) "Applying the policy factors discussed in Wiley and Coscia, we conclude Sangha must show actual innocence on the misdemeanor vandalism offense, even though Sangha limited his malpractice claim to the representation he received on the felony vandalism charge." (Sangha, supra, at p. 88.) Moreover, "[p]ostconviction exoneration is a `final disposition' of the underlying case. (Coscia, supra, 25 Cal.4th at p. 1205.) Probation, however short, is not a final disposition exonerating the criminal defendant. Here, Sangha failed to introduce any evidence he received postconviction relief on his misdemeanor conviction." (Sangha, supra, at p. 90.)
The only distinction between Sangha and the instant case is that Sangha ultimately entered a plea to a necessarily included offense, while Wilkinson's *48 pleasto driving under the influence and interfering with an officer in the performance of his or her dutywere transactionally related offenses that did not qualify as necessarily included offenses of battery on a custodial officer.[4] The court in Sangha specifically left open the issue of whether Coscia's requirement of exoneration applies to transactionally related offenses. "Because the issue has no bearing on our decision, we do not decide whether the actual innocence requirement applies to all transactionally related offenses." (Sangha, supra, 146 Cal.App.4th at p. 90, fn. 8.)
Turning to the issue left open by Sangha, we hold that Wilkinson must be exonerated of all transactionally related offenses in order to satisfy the holding in Coscia. Because the judicially noticed facts unequivocally demonstrate that Wilkinson plead no contest to two offenses transactionally related to the felony charge of battery on a custodial officer in order to settle the criminal action, and she was placed on probation for those offenses, she cannot in good faith plead exoneration, and the demurrer was properly sustained.
This conclusion is consistent with the thrust of both Wiley and Coscia that one who engages in criminal conductwhich Wilkinson undisputedly did may not recover in a legal malpractice action. Other remedies, such as a new trial or a plea to a reduced offense, as happened here, are a sufficient remedy for legal malpractice in a criminal prosecution. (Wiley, supra, 19 Cal.4th at p. 543.) There is nothing in Wiley or Coscia that suggests our Supreme Court has any inclination to carve out an exception that would parse transactionally related offenses in the manner urged by Wilkinson so as to allow a person convicted of multiple offenses to maintain a malpractice action. To the contrary, the gist of Wiley and Coscia is that one who commits a criminal offense may not bring a legal malpractice action.
*49 We reject the suggestion that because this case reaches us at the demurrer stage a different result is required. In Coscia, the court affirmed an order sustaining a demurrer on the ground the plaintiff could not establish exoneration of a charge to which he had plead guilty or no contest. (Coscia, supra, 25 Cal.4th at pp. 1204-1205.) The only reason leave to amend was granted in Coscia was because the demurrer was sustained before Wiley held that factual innocence was an element of a legal malpractice action following a criminal conviction. (Id. at p. 1211.) In light of the undisputed facts that are properly before the court by way of judicial notice, Wilkinson cannot in good faith plead exoneration of all transactionally related criminal charges and the demurrer was properly sustained.
As Coscia, Wiley, and Sangha make clear, a plaintiff in a legal malpractice action based on an attorney's handling of a criminal action may not prevail unless he or she is factually innocent and exonerated of criminal liability. Wilkinson fails on both levels and the demurrer was properly sustained.

Leave to Amend
Wilkinson asks for leave to amend the complaint in the event this court determines the complaint was too broad and should be limited to a claim for damages on the felony Penal Code section 243.1 charge. The trial court did not abuse its discretion in denying leave to amend.
It is an abuse of discretion to deny leave to amend a complaint after a demurrer is sustained if there is a reasonable possibility that the pleading can be cured by amendment. (Lee v. Los Angeles County Metropolitan Transportation Authority (2003) 107 Cal.App.4th 848, 854 [132 Cal.Rptr.2d 444].) The burden is on the plaintiff to demonstrate how he or she can amend the complaint. (Blank v. Kirwan (1985) 39 Cal.3d 311, 318 [216 Cal.Rptr. 718, 703 P.2d 58].) A plaintiff can make this showing in the first instance to the appellate court. (Lee v. Los Angeles County Metropolitan Transportation Authority, supra, 107 Cal.App.4th at p. 854; Roman v. County of Los Angeles (2000) 85 Cal.App.4th 316, 321-322 [102 Cal.Rptr.2d 13].)
The problem with Wilkinson's complaint is not that it is too broad in that it encompasses both the felony and misdemeanor charges against her. The difficulty with the complaint is that, given the immutable facts, Wilkinson cannot in good faith plead factual innocence of a crime or exoneration.

DISPOSITION
The judgment is affirmed. Zelen is awarded his costs on appeal.
Arsmtrong, Acting P. J., concurred.
*50 MOSK, J., Dissenting.
This case raises an issue not considered in Wiley v. County of San Diego (1998) 19 Cal.4th 532 [79 Cal.Rptr.2d 672, 966 P.2d 983] (Wiley), Coscia v. McKenna & Cunio (2001) 25 Cal.4th 1194 [108 Cal.Rptr.2d 471, 25 P.3d 670] (Coscia) or Sangha v. LaBarbera (2006) 146 Cal.App.4th 79 [52 Cal.Rptr.3d 640] (Sangha). The court in Sangha specifically left open the issue raised in this case. (Sangha, supra, at p. 90, fn. 8.) I believe the trial court erred in determining that plaintiff and appellant Jaleh Wilkinson (Wilkinson) could not plead a cause of action for malpractice. I would reverse the judgment to allow Wilkinson the opportunity to attempt to plead facts sufficient to state such a cause of action.
A jury convicted Wilkinson of one felony (Pen. Code, § 243.1 [felony battery on a custodial officer]) and two misdemeanors (Veh. Code, §§ 23152, subd. (a) [driving under the influence], 20002, subd. (a) [failing to stop at the scene of an accident]). Wilkinson was represented at her criminal trial by defendant and respondent Garrett Jason Zelen and the Law Offices of Garrett J. Zelen (collectively Zelen). Although the California Supreme Court affirmed Wilkinson's convictions on direct appeal (People v. Wilkinson (2004) 33 Cal.4th 821 [16 Cal.Rptr.3d 420, 94 P.3d 551]), the Court of Appeal issued an order to show cause returnable in the trial court on Wilkinson's petition for a writ of habeas corpus. Wilkinson alleged in her petition that Zelen had provided ineffective representation at her trial. The prosecution did not oppose the habeas corpus petition. The trial court granted Wilkinson a writ of habeas corpus and vacated her convictions on all three counts. Pursuant to a plea agreement, Wilkinson subsequently entered no contest pleas to two misdemeanor counts. (Veh. Code, § 23152, subd. (a) [driving under the influence]; Pen. Code, § 148 [resisting, delaying or obstructing a public officer, peace officer, or emergency medical technician].)
Wilkinson sued Zelen for legal malpractice and breach of contract. The trial court sustained Zelen's demurrer to Wilkinson's first amended complaint without leave to amend on the basis that Wilkinson had not been exonerated by postconviction relief and could not plead that she was actually innocent, citing Coscia, supra, 25 Cal.4th 1194 and Wiley, supra, 19 Cal.4th 532.
I would reverse the judgment. Wilkinson obtained postconviction relief by obtaining a writ of habeas corpus. Although Wilkinson subsequently pleaded no contest to two misdemeanor counts, she should have the opportunity to attempt to plead actual innocence as to the felony conviction that was vacated by the writ of habeas corpus and that formed the gravamen of her malpractice claim against Zelen, and to plead that the felony conviction was unrelated to the two counts to which she pleaded no contest.


*51 DISCUSSION

A. Exoneration

In Coscia, supra, 25 Cal.4th 1194, the Supreme Court held that a plaintiff alleging malpractice against an attorney who represented the plaintiff in criminal proceedings resulting in a conviction must allege facts showing that the plaintiff obtained postconviction relief for that conviction "in the form of a final disposition of the underlying criminal casefor example, by acquittal after retrial, reversal on appeal with directions to dismiss the charges, reversal followed by the People's refusal to continue the prosecution, or a grant of habeas corpus relief." (Id. at p. 1205.) Wilkinson alleged such facts. The trial court granted a habeas corpus writ, and Wilkinson's three convictions were vacated. The felony count was dismissed on the People's motion. Wilkinson's claim for malpractice relates only to her conviction on the felony count.
Sangha, supra, 146 Cal.App.4th 79, is distinguishable. In that case, the plaintiff originally pleaded guilty to felony vandalism. The plea was later set aside, and the plaintiff pleaded guilty to the lesser included offense of misdemeanor vandalism, based on the same conduct charged in the felony. (Id. at pp. 82-83.) As a result, the final disposition of the crime that was the basis of the plaintiff's malpractice complaint (the felony vandalism conviction) was not exoneration, but a conviction on a lesser included offense and a sentence of probation. The court in Sangha therefore held that the plaintiff had not obtained a final disposition of the vandalism charge that exonerated him. (Id. at p. 90.) The court appeared to conflate the requirements for actual innocence and those for exoneration.
Unlike in Sangha, supra, 146 Cal.App.4th 79, the plaintiff here, Wilkinson, may be able to allege in an amended pleading that her misdemeanor convictions are based on criminal conduct separate and distinct from the conduct that gave rise to her conviction for felony battery of a custodial officer. As described by the California Supreme Court, the crimes of which Wilkinson originally was convicted arose from two distinct courses of conducther conduct in driving under the influence and fleeing from police, on the one hand, and her conduct after she had been arrested, transported to the jail and booked, on the other hand. (People v. Wilkinson, supra, 33 Cal.4th at pp. 828-829.)
Whether two crimes are transactionally related is a factual determination requiring consideration of all the circumstances relating to the admitted offense. (People v. Calhoun (2007) 40 Cal.4th 398, 406-407 [53 Cal.Rptr.3d 539, 150 P.3d 220]; People v. Harvey (1979) 25 Cal.3d 754, 758-759 [159 Cal.Rptr. 696, 602 P.2d 396]; People v. Beagle (2004) 125 Cal.App.4th 415, *52 421-422 [22 Cal.Rptr.3d 757]; People v. Guevara (1979) 88 Cal.App.3d 86, 92-94 [151 Cal.Rptr. 511].) Crimes are transactionally related only if they involve "facts from which it could . . . be inferred that some action of the defendant giving rise to the dismissed count was also involved in the admitted count." (People v. Beagle, supra, 125 Cal.App.4th at p. 421.) Here, Wilkinson's malpractice complaint is based on her conviction for the felony charge of battery of a custodial officer, which occurred after she had been arrested and transported to the jail. One misdemeanor count of which Wilkinson now stands convicteddriving under the influencenecessarily was based on her conduct prior to her arrest, and thus separate from that involved in the felony battery charge. If the other misdemeanor count of which she stands convictedobstructing a peace officeralso is not factually related to the felony battery charge, then those offenses are not transactionally related. Nothing in Coscia, supra, 25 Cal.4th 1194, requires that a plaintiff obtain postconviction exoneration for crimes different than those that underlie her malpractice action. Even assuming that Wilkinson had not adequately pleaded exoneration by alleging the granting of a writ of habeas corpus, she should be given the opportunity to plead that she has satisfied the exoneration requirement by not entering a plea of no contest to the felony battery crime or any crime transactionally related to that crime.
In addition to whether the charges were transactionally related, it might be relevant to the issue of exoneration whether Wilkinson pleaded no contest to the misdemeanor charge of obstructing a peace officer in exchange for the People's agreement not to pursue the felony battery count. Neither the complaint nor the matters subject to judicial notice conclusively establish that she did so. If the existence of such a plea bargain is determinative, Wilkinson should be given the opportunity to plead that her plea of no contest was not given in exchange for the People's agreement not to proceed on the felony charge.

B. Actual Innocence

The court in Sangha, supra, 146 Cal.App.4th 79, a case that arose on summary judgment, raised the following point: "The parties disagree on the scope of the actual innocence requirement. Does it apply only to specific offenses that are the subject of a plaintiff's malpractice action? Does this requirement encompass lesser included offenses? Or, more broadly, does it apply to all related offenses that were or might have been charged? (Wiley, supra, 19 Cal.4th at p. 547 (conc. opn. of Werdegar, J.).) Wiley does not directly address these issues." (Sangha, supra, 146 Cal.App.4th at p. 86.) The court stated, "Our analysis is two-fold: Even assuming Sangha need only show actual innocence on the felony vandalism charge, his separate statement fails to demonstrate a triable issue of fact on this issue. And even if Sangha *53 could surmount this obstacle, we conclude the rationale of Wiley and Coscia requires a plaintiff in a criminal legal malpractice case to show actual innocence and postconviction exoneration on any guilty finding for a lesser included offense, even though the plaintiff alleges he received negligent representation only on the greater offense. Because Sangha fails to make this showing, he cannot prevail on appeal." (Sangha, supra, 146 Cal.App.4th at p. 87.)
The court in Sangha, supra, 146 Cal.App.4th 79, specified that a plaintiff asserting malpractice in a criminal matter cannot establish actual innocence if he or she was found guilty of a lesser included offense. Here, as noted above, the offenses to which plaintiff ultimately entered no contest pleasdriving under the influence and obstructing a peace officermay be separate from and unrelated to the felony count of battery of a custodial officer. If Wilkinson can plead facts that the two misdemeanors of which she stands convicted involved conduct unrelated to the felony battery conviction (see People v. Wilkinson, supra, 33 Cal.4th at pp. 827-828), she can state a cause of action for professional negligence.[1]
If Wilkinson can plead such facts, the policy considerations upon which the court in Wiley, supra, 19 Cal.4th 532, based the requirement of actual innocence would not be implicated in this case. She would not profit from the criminal conduct of which she stands convicted (id. at p. 537); she would not escape or diminish her punishment for that conduct (id. at pp. 537-538); and there would be no prospect of conflicting resolutions on the issue of whether she committed a battery against a custodial officer (id. at p. 544). Moreover, although Wilkinson has obtained postconviction relief on her felony conviction, she has not been afforded full relief for her attorney's alleged negligence. She allegedly suffered damages resulting specifically from her conviction on the felony count, including the loss of her job and denial of her petition for naturalization, that are readily compensable in money damages. (Id. at pp. 542-543.)
The difference between this case and both Wiley, supra, 19 Cal.4th 532, and Sangha, supra, 146 Cal.App.4th 79, is illustrated by a troubling hypothetical raised by plaintiff's attorney in the trial court. "Suppose a defendant is convicted of a multi-count indictment and one of the convictions is first degree murder and another conviction is trespass, and a habeas corpus petition is granted, and the murder conviction is dismissed outright, yet the defendant pleads nolo contendere to the trespass, which is essentially the situation we have here. [¶] And does public policy prevent that defendant *54 from suing his or her attorney on the felony conviction when they have been actually innocent of that crime." The trial court said that, although the result was "possibly unjust," it was bound by Wiley.
The court in Wiley, supra, 19 Cal.4th 532, in quoting from a prior Court of Appeal decision, states, "In sum, `the notion of paying damages to a plaintiff who actually committed the criminal offense solely because a lawyer's negligence failed to secure an acquittal is of questionable public policy and is contrary to the intuitive response that damages should only be awarded to a person who is truly free from any criminal involvement.'" (Wiley, supra, 19 Cal.4th at p. 539, italics added, quoting Holliday v. Jones (1989) 215 Cal.App.3d 102, 115, fn. 7 [264 Cal.Rptr. 448].) The court in Wiley also said that "`allowing civil recovery for convicts impermissibly shifts responsibility for the crime away from the convict.'" (Id. at p. 537.) The court added, "If the defendant has in fact committed a crime, the remedy of a new trial or other relief is sufficient reparation in light of the countervailing public policies and considering the purpose and function of constitutional guaranties. [Citations.]" (Id. at p. 543.)
Such language, if read broadly, could support the conclusion that a malpractice plaintiff must establish actual innocence of any criminal conduct in the criminal case in which the attorney represented the plaintiff, even if the plaintiff ultimately does not stand convicted of the particular crime relied upon in the malpractice claim. But the court in Wiley, supra, 19 Cal.4th 532, did not address the situation here. And neither did the court in Sangha, supra, 146 Cal.App.4th 79. If there can be no liability for malpractice in connection with one count when there are no contest pleas as to unrelated counts, then we allow the injustice to which the trial court alluded in connection with the hypothetical. I read the court's language in Wiley to mean that no malpractice action can be brought if the plaintiff cannot prove actual innocence of all criminal activity arising from the conduct underlying the conviction that is the subject of the malpractice action. The fact that a malpractice plaintiff committed some crimeno matter how unrelated to the crime of which the plaintiff was exonerated and is innocentshould not bar the plaintiff's malpractice action based on the attorney's negligence in connection with the exonerated crime.
This case arises on a demurrer. The trial court's decision was based on the premise that under no circumstances could Wilkinson state a cause of action. As explained above, Wilkinson was exonerated on the felony battery count. She should have the opportunity to attempt to plead and establish that she was, in fact, innocent of that offense and any lesser included or related offense, and that the crimes to which she pleaded no contest involved facts *55 unrelated to the felony battery count of which she was exonerated. (See Coscia, supra, 25 Cal.4th at p. 1211 [granting leave to amend to allege actual innocence].)
It is true that no court has determined that plaintiff is actually innocent of felony battery. But that is not dispositive. Indeed, the Supreme Court stated in Coscia, supra, 25 Cal.4th at page 1205, that a plaintiff may maintain a malpractice case so long as the plaintiff obtains "postconviction relief in the form of a final disposition of the underlying criminal casefor example, by . . . reversal followed by the People's refusal to continue the prosecution, or a grant of habeas corpus reliefas a prerequisite to proving actual innocence in a malpractice action against former criminal defense counsel." Here, plaintiff has fulfilled the prerequisite and now pleads and seeks to prove actual innocence.
I would reverse the judgment.
NOTES
[1]  Similar causes of action were alleged against Lawrence Wolf and the Law Offices of Lawrence Wolf. Wolf is not a party to this appeal.
[2]  Zelen was incorrect, as Wilkinson expressly alleged factual innocence. The argument is not pursued on appeal.
[3]  The parties also filed motions for judicial notice on appeal. The unopposed motions are granted.
[4]  A necessarily included offense is a crime in which (1) the statutory elements of the greater offense include all of the statutory elements of the lesser offense, or (2) the facts alleged in the accusatory pleading include all of the elements of the lesser offense. (People v. Reed (2006) 38 Cal.4th 1224, 1227-1228 [45 Cal.Rptr.3d 353, 137 P.3d 184].) Under the statutory elements test, Penal Code section 148, subdivision (a)(1) is not a necessarily included offense of battery on a custodial officer under Penal Code section 243.1, because section 148 may be violated without an unlawful touching. (People v. Green (1997) 51 Cal.App.4th 1433, 1437-1438 [59 Cal.Rptr.2d 913] [sufficient evidence of Pen. Code, § 148 violation existed where defendant removed a child to avoid an interview of the child by peace officers and also intimidated the child into denying the commission of an offense]; People v. Quiroga (1993) 16 Cal.App.4th 961, 967-968 [20 Cal.Rptr.2d 446] [arrestee's refusal to provide his name at the time of booking is sufficient evidence to support a violation of Pen. Code, § 148].) The accusatory pleading test has no role in this case, as no formal amended accusatory pleading was filed when the prosecutor verbally amended the information to add the violation of Penal Code section 148, subdivision (a)(1), as part of the case settlement agreement.
[1]  The court in Sangha, supra, 146 Cal.App.4th at page 90, footnote 8 said, "Because the issue has no bearing on our decision, we do not decide whether the actual innocence requirement applies to all transactionally related offenses."
