
14 Cal.App.3d 362 (1971)
92 Cal. Rptr. 248
THE PEOPLE, Plaintiff and Appellant,
v.
THE MUNICIPAL COURT FOR THE SAN DIEGO JUDICIAL DISTRICT OF SAN DIEGO COUNTY, Defendant and Respondent; FRANK MARTINEZ, Real Party in Interest.
Docket No. 10181.
Court of Appeals of California, Fourth District, Division One.
January 14, 1971.
*364 COUNSEL
John W. Witt, City Attorney, J. David Franklin and Larry L. Marshall, Deputy City Attorneys, for Plaintiff and Appellant.
Bertram McLees, Jr., County Counsel, and Lloyd M. Harmon, Jr., Deputy County Counsel, for Defendant and Respondent.
No appearance for Real Party in Interest.
OPINION
AULT, J.
The People appeal from a judgment of the San Diego County Superior Court discharging an alternative writ and denying their petition for a peremptory writ of mandate. They sought the writ to compel the municipal court to vacate its order dismissing two misdemeanor counts charging real party in interest, Frank Martinez, with soliciting a lewd act (Pen. Code, § 647, subd. (a)). The municipal court ordered the dismissals on May 16, 1969, after Martinez had entered a plea of guilty to a third misdemeanor charge contained in a separate complaint (possession, with the intent to exhibit or distribute, obscene materials, Pen. Code., § 311.2). The plea of guilty resulted from a negotiated plea bargain between Martinez and his attorney and the prosecutor. The court's minutes reflect the two Penal Code section 647, subdivision (a), counts were dismissed on motion of the People, in the furtherance of justice and in view of the plea of guilty to the Penal Code section 311.2 charge.
The attorney for Martinez then mentioned the case of Stanley v. Georgia, 394 U.S. 557 [22 L.Ed.2d 542, 89 S.Ct. 1243], decided on April 7, 1969, which held a Georgia statute, making the mere private possession of obscene material illegal, unconstitutional under the First and Fourteenth Amendments of the U.S. Constitution. The parties had previously stipulated the allegedly obscene material had been found in Martinez' possession in his residence, and his attorney asserted Martinez had not violated Penal Code section 311.2 because private possession of obscene material was no longer a crime under the ruling of the Stanley case. The judge indicated Martinez had negotiated a plea with the prosecutor and he would not hear argument on the merits of the charge to which he had pleaded guilty. He set the probation hearing for June 6, 1969.
However, at the probation hearing, the judge stated he had then read the Stanley case and the probation report and felt he could not accept the guilty *365 plea which had been entered three weeks before. He invited Martinez to move to set aside the guilty plea. The motion was made and granted. The prosecutor then moved the court to vacate the previously ordered dismissal of the two counts charging violation of Penal Code section 647, subdivision (a). The judge denied the motion, stating he was precluded from reinstating the dismissed counts by the provision of Penal Code section 1387.[1]
The People forthwith appealed from the order permitting the defendant to withdraw his guilty plea to the appellate department of the superior court. The appeal was dismissed by the appellate department because the order appealed from was nonappealable under the provisions of Penal Code section 1466. Undaunted, the prosecutor next petitioned the superior court for a writ of mandate directing the municipal court to vacate the order dismissing the two Penal Code section 647, subdivision (a), charges. The superior court denied the petition. Still undaunted, the People have appealed.
(1a) The People urge the guilty plea and the dismissal of the other two misdemeanor counts were arrived at through a court-approved negotiated plea bargain, were inextricably related and were conditioned one upon the other. When Martinez was permitted to withdraw his plea of guilty, they maintain the dismissed misdemeanor counts should have been reinstated and that the court erred in denying the motion to vacate the order dismissing them. Respondent court contends to the contrary and maintains the provision of Penal Code section 1387 precluded it from granting the motion to vacate.
We are unable to reach the issue in these proceedings. The insurmountable obstacle which confronts the People is that no matter which contention is correct, mandate will not lie. If, as respondent court contends, the statute prevented it from vacating the dismissals, neither the superior court nor this court could properly order it to do that which the statute forbids. If the contrary is true, and the statute, under the particular circumstances of the case, did not preclude the court from vacating the dismissals, the People should have appealed from the order denying the motion to vacate.
(2) Mandate may not be resorted to as a substitute for the legal remedy of appeal. "The writ of mandate will not issue solely to serve the purpose of a writ of review in order to pass upon claimed errors which are properly reviewable by means of an appeal." (Petaluma etc. Dist. v. Superior Court, 194 Cal. 183, 184 [228 P. 24]; see also Andrews v. Police Court, 21 Cal.2d 479, 480 [133 P.2d 398, 145 A.L.R. 1042].)
*366 (3) Ordinarily, an appeal will not lie from an order denying a motion to vacate an order or judgment which itself was appealable. To permit an appeal from the order refusing to vacate, would allow two appeals from the same decision, or, if a party failed to appeal within the prescribed time limit, allow him an unwarranted extension of time running from the date of the second order. (3 Witkin, Cal. Procedure (1954) pp. 2170-2171; Estate of Baker, 170 Cal. 578, 581-583 [150 P. 989]; Title Ins. & Trust Co. v. California etc. Co., 159 Cal. 484, 487 [114 P. 838].) The rule is different, however, and an appeal is allowed from the denial of a motion to vacate an appealable judgment or order where the party appealing, without fault on his part, had no opportunity to effectively appeal from the judgment or order. (3 Witkin, Cal. Procedure (1954) pp. 2171-2172; Estate of Baker, supra, 170 Cal. 578, 582; Title Ins. & Trust Co. v. California etc. Co., supra, 159 Cal. 484, 487.)
(1b) The original order of the municipal court dismissing the two misdemeanor counts was an appealable order. (Pen. Code, § 1466; People v. Ring, 26 Cal. App.2d Supp. 768, 770 [70 P.2d 281]; People v. Winters, 171 Cal. App.2d Supp. 876, 880 [342 P.2d 538]; People v. Gonzales, 235 Cal. App.2d Supp. 887, 891 [46 Cal. Rptr. 301].) However, the People, without fault, had no opportunity, reason, or legal basis to appeal from the order dismissing the misdemeanor counts while the bargain they made with Martinez remained intact. Three weeks later, when Martinez was permitted to withdraw his guilty plea, and the agreement came unglued, the time in which to appeal from the order of dismissal had expired. (Rule 182, Cal. Rules of Court.) The People moved to vacate the order of dismissal. If, as they claim here, the court erred in denying the motion to vacate, they should have appealed from the order of denial. Under the circumstances, the order denying the motion to vacate was "... an order made after judgment affecting the substantial rights of the People," and appealable by the People. (Pen. Code, § 1466.) No appeal was taken from the order. Nevertheless, at the time, the People had available the remedy of appeal to resolve the issue they attempt to present in these proceedings. The fact the remedy was lost by the failure to exercise the right to it does not require the granting of a writ of mandate. (Andrews v. Police Court, supra, 21 Cal.2d 479, 480-481.)
If the People had their pockets picked in the criminal case, it was because they neglected to button down the flaps. They appealed from a nonappealable order and failed to appeal from an order which was appealable. As a result, in these proceedings, they are boxed in and unable to reach the issue they wish resolved. This does not mean we should *367 deviate from well established rules governing mandate or that the superior court erred in denying the petition for the writ.
The judgment is affirmed.
Coughlin, Acting P.J., and Whelan, J., concurred.
NOTES
[1]  Penal Code section 1387 reads: "An order for the dismissal of the action, made as provided in this chapter, is a bar to any other prosecution for the same offense if it is a misdemeanor, but not if it is a felony."
