
66 Cal.2d 863 (1967)
JAMES ERNEST ANDERSON, Petitioner,
v.
THE SUPERIOR COURT OF SOLANO COUNTY, Respondent; THE PEOPLE, Real Party in Interest.
S. F. No. 22495. 
Supreme Court of California. In Bank.  
June 16, 1967.
 Winters, Winters & Coan and Robert K. Winters for Petitioner.
 Thomas C. Lynch, Attorney General, Albert W. Harris, Jr., Assistant Attorney General, Robert R. Granucci and William D. Stein, Deputy Attorneys General, for Respondent and for Real Party in Interest. *864
 MOSK, J.
 In this proceeding for a writ of prohibition we adjudicate, for the first time in this state, the question whether the People may pursue an appeal from an order dismissing an accusatory pleading under section 995 of the Penal Code and, while that appeal is pending, file a new pleading charging the same offense and proceed to trial on the second pleading. For reasons stated hereinafter, we conclude that although the People may simultaneously file an appeal from the dismissal of the first pleading and seek a new accusation, they should be required to elect between these two courses of action either when the second accusation has survived a motion under section 995 or at the time of arraignment for plea, whichever first occurs.
 Petitioner was indicted by a grand jury for the murder of two police officers. On May 9, 1966, his motion under section 995 of the Penal Code was granted by the superior court for the reason that he had been indicted without reasonable and probable cause in that "the record is devoid of identification of the defendant now in custody." The court ordered (as allowed by Pen. Code,  997, 998) that a preliminary examination be held before a magistrate and that if the petitioner be committed or held to answer, an information against him be filed by the district attorney. A notice of appeal from the order setting aside the indictment was filed by the People on the same day, and that appeal is now pending in the Court of Appeal.
 On May 26, subsequent to the filing of the notice of appeal, a preliminary hearing was held at which eyewitnesses identified petitioner. He was held to answer, and an information was filed charging him with the murder of the two officers.petitioner pleaded not guilty, and the matter was set for trial. During the voir dire examination of jurors, however, the trial court requested counsel to submit authorities on the question of its jurisdiction to proceed. Thereafter, the court suggested a continuance until the jurisdictional issue could be determined. The present proceeding in prohibition was then instituted, and the trial has been postponed pending its determination.
 Petitioner contends he should not be compelled to defend an appeal and simultaneously prepare for trial on the basis of the second accusation. He maintains that the People are not prejudiced if they are required to elect between the alternatives of appealing from the dismissal of the indictment under section 995 or filing a new information or indictment. The *865 argument is that if the defect in the first accusation is in the sufficiency of the evidence, it can be cured by the filing of a new pleading and the presentation of new evidence; on the other hand, if the defect in the original pleading relates to a question of law, the proper method to proceed is by appeal.
 For their part, the People contend that they are not barred from pursuing both remedies. They recognize the general rule that an appeal from an order in a criminal case removes the subject matter of that order from the jurisdiction of the trial court (e.g., People v. Sonoqui (1934) 1 Cal.2d 364 [35 P.2d 123]; People v. Fewkes (1931) 214 Cal. 423 [6 P.2d 250]), but claim that the "subject matter" of the order setting aside the indictment is the indictment itself rather than the criminal act giving rise to the indictment. It is further contended that the People are entitled to have the sufficiency of the indictment tested in an appellate court, and that this right of appeal is effectively denied if the People cannot simultaneously pursue this remedy and the statutory right to file a new accusation based on the same charges (Pen. Code,  999).
 There is some merit in both parties' positions. However, we believe that only by adopting a moderate course between the two extremes can we assure fairness to both sides.
 Petitioner cites a number of cases in support of his view, most of which are readily distinguishable.  [fn. 1] The only decision cited by the parties involving the filing of two accusatory pleadings is People v. Owens (1945) 71 Cal.App.2d 831 [164 P.2d 28]. There the defendant was tried and found guilty, and made a motion in arrest of judgment on the ground that *866 the information upon which he had been tried failed to state a cause of action. The district attorney immediately gave an oral notice of appeal from the granting of the motion. The next day he attempted to withdraw this notice, and filed a new information charging the same crime. The defendant was tried a second time on the new information for the same offense, and was again found guilty. The appellate court held that the attempt by the prosecution to withdraw the notice of appeal was ineffectual, that an appeal from the order granting the motion was pending in the appellate court and the trial court no longer had jurisdiction of the subject matter, and hence the trial court had no jurisdiction to retry the defendant until the appeal had been determined.
 After full consideration of this issue, we are of the opinion that the decision of this court in People v. Lee (1895) 107 Cal. 477 [40 P. 754], points to the proper solution. In Lee a demurrer to the first indictment was sustained. At that point the court, without a prior request from either side, ordered the People to seek a new indictment. The People appealed from the order sustaining the demurrer; the defendant moved to dismiss the appeal, contending that the order requiring the People to resubmit the case "cut off the right" of the People to appeal. In rejecting this contention, this court held that "the right of the people to appeal cannot be lost by an order of the court made of its own volition directing a submission to another grand jury. The right of appeal is guaranteed to the people by section 1238 of the Penal Code, and it is an important right. Where the district attorney admits the defect in his pleading he will avail himself of the opportunity offered by the order for resubmission and decline to appeal. But in those cases where he is satisfied with the form of the indictment, or where the facts will not permit another and different one to be framed, he has the right, representing the people, to stand upon its sufficiency and have the matter determined by the appellate court. If, by its order to submit the cause anew, the trial court could deprive him of this right, it must result that he would be compelled to come again into court with the same form of indictment, which would again be overthrown, to the end that the defendant would never be tried, and the people, with the right of appeal secured to them, would never be permitted to have this court pass upon a pleading which was believed to be legally sufficient." (Id at pp. 478-479.)  [fn. 2]*867
 [1] The rule of the Lee case, however, should be applied in such a manner as to foreclose the possibility of harassment of the defendant, and to that end the People should elect as soon as feasible between maintaining the appeal or proceeding under the new accusatory pleading. At the latest, this election should occur either when the new accusatory pleading withstands a motion under section 995 or at the time of arraignment for plea, whichever first occurs. We thereby assure the People an opportunity to obtain a valid accusatory pleading on which to go to trial, yet also guarantee that the defendant will not be called upon to defend an appeal and at the same time a trial on the basis of a second accusation, both resulting from the same alleged crime.
 The peremptory writ of prohibition will issue as prayed, unless within 10 days from the date our opinion becomes final the People dismiss the appeal in 1 Crim. 5760, and so inform this court in writing.
 Traynor, C. J., McComb, J., Peters, J., Tobriner, J., Burke, J., and Schauer, J.,  [fn. *] concurred.
NOTES
[fn. 1]  1. In People v. Helsley (1940) 41 Cal.App.2d 935 [108 P.2d 97], the lower court was held powerless to vacate its own judgment after a notice of appeal. In France v. Superior Court (1927) 201 Cal. 122 [255 P. 815, 52 A.L.R. 869], the defendants were convicted of certain crimes and appealed from their convictions, contending that the trial court had no jurisdiction over the action. Subsequently, the trial court granted them a writ of habeas corpus to inquire into the same question, and it was held that it had no jurisdiction to entertain the habeas corpus proceeding pending the determination of the jurisdictional issue on appeal. In People v. Sonoqui (1934) supra, 1 Cal.2d 364, the court determined that, after the district attorney had appealed from an order granting a new trial, it was improper for the trial court to proceed with the new trial in disregard of the appeal. In State v. Jackson (1961) 228 Ore. 371 [365 P.2d 294, 89 A.L.R.2d 1225], it was held that a trial court improperly proceeded to trial after the defendant had filed an appeal from the lower court's refusal to dismiss the indictment because he had not been timely brought to trial; the appellate court based its holding on the fact that the trial court could not proceed to trial without determining the only question involved in the appeal.
[fn. 2]  2. On the question of the People's right to pursue both remedies simultaneously, see generally Notes, 89 A.L.R.2d 1236; 92 A.L.R. 1137-1165; 35 So.Cal.L.Rev. 355, 356-361 (1962); 4 So.Cal.L.Rev. 69-70 (1930).
[fn. *]  *. Retired Associate Justice of the Supreme Court sitting under assignment by the Chairman of the Judicial Council.
