
164 Cal.App.3d 979 (1985)
211 Cal. Rptr. 32
In re CEDRIC DESHAWN WILLIAMS on Habeas Corpus.
Docket No. A027414.
Court of Appeals of California, First District, Division Three.
February 21, 1985.
*980 COUNSEL
Deborah Tuttelman, under appointment by the Court of Appeal, for Petitioner.
John K. Van de Kamp, Attorney General, Clifford F. Campbell, Ann K. Jensen and Frances Marie Dogan, Deputy Attorneys General, for Respondent.
*981 OPINION
BARRY-DEAL, J.
(1a) We hold that a magistrate's refusal or failure to hold a defendant to answer on one count of a complaint constitutes a dismissal of that count, pursuant to Penal Code section 871,[1] for purposes of section 1387, so that another dismissal bars prosecution for the offense.

Procedural History
On May 19, 1982,[2] a preliminary hearing was held in Santa Clara Municipal Court before Judge Edward B. Pearce II. At the conclusion of the hearing, the court held petitioner to answer for receiving stolen property, out regarding a charge of burglary, the court said, "There will be no holding as to Count 1."
On June 1, the district attorney, pursuant to section 739, filed an information charging petitioner with both offenses  burglary and receiving stolen property. On July 26, defense counsel moved to dismiss the information pursuant to section 995, arguing insufficiency of the evidence. On August 9, the superior court granted the motion on the burglary count and denied it on the charge of receiving stolen property.
On August 16, the superior court dismissed the case on motion of the district attorney, who noted that the People would refile both charges in the municipal court.
A second preliminary hearing was held before a different municipal court judge on December 20, and petitioner was held to answer on both charges. The district attorney filed an information charging both offenses on December 27. Petitioner entered a plea of not guilty and waived time.
On March 1, 1983, petitioner moved to dismiss pursuant to section 995, again arguing insufficiency of the evidence. On March 21, 1983, the court denied the motion as to both counts. The matter proceeded to trial. Petitioner then waived a jury on condition that the charged burglary be stipulated to be in the second degree and that if convicted he would not be sentenced to state prison.
On April 5, 1983, the court found petitioner guilty of burglary and not guilty of receiving stolen property. On May 6, 1983, the court suspended imposition of sentence and placed petitioner on two years' probation. An *982 appeal followed, in which petitioner claimed that error occurred under section 1387 and that the evidence was insufficient to support the judgment. We declined to reach the procedural issues, which we address in this writ proceeding, and we affirmed the judgment in an unpublished opinion.[3]

Discussion
(2a) Petitioner claims that trial counsel's failure to make a motion to dismiss count one (burglary) pursuant to section 1387 deprived him of effective assistance of counsel. We agree.
(1b) Section 1387 provides, in relevant part: "An order terminating an action pursuant to ... Section ... 871, or 995, is a bar to any other prosecution for the same offense if it is a felony ... and the action has been previously terminated pursuant to ... Section ... 871, or 995, ..."
There is no question that when the court granted petitioner's section 995 motion to dismiss the burglary count of the information on August 9, this was an order "terminating an action" within the meaning of section 1387. The sole issue on which petitioner and the People disagree is whether the May 19 statement of Judge Pearce that "There will be no holding as to Count 1 [burglary]" constituted a termination of the action pursuant to section 871, so that the subsequent conceded termination barred further prosecution. We hold that it did.
Section 871 provides: "If, after hearing the proofs, it appears either that no public offense has been committed or that there is not sufficient cause to believe the defendant guilty of a public offense, the magistrate shall order the complaint dismissed and the defendant to be discharged, by an indorsement on the depositions and statement, signed by the magistrate, to the following effect: `There being no sufficient cause to believe the within named A.B. guilty of the offense within mentioned, I order that the complaint be dismissed and that he or she shall be discharged.'"[4]
*983 (3) Despite the all-or-nothing wording of this statute, it obviously applies where the magistrate finds insufficient evidence of and dismisses one count, but sufficient evidence of others. (See, e.g., Dunn v. Superior Court (1984) 159 Cal. App.3d 1110 [206 Cal. Rptr. 242]; Lee v. Superior Court (1983) 142 Cal. App.3d 637 [191 Cal. Rptr. 361].)
(1c) The People contend that the magistrate's statement that there would be "no holding," without more, does not constitute a dismissal within the meaning of section 871. We cannot agree. (4), (1d) The purpose of the statutory scheme in question is the prevention of prosecutorial harassment and forum-shopping. (People v. Horning (1984) 150 Cal. App.3d 1015, 1021 [198 Cal. Rptr. 384]; see Ramos v. Superior Court, supra, 32 Cal.3d at p. 35.) This purpose would be defeated by permitting the People to charge an offense a third time simply because the magistrate neglected to reduce his or her decision of dismissal to writing. We therefore hold that a failure or refusal to hold, even without a formal order of dismissal, constitutes a termination of the action within the meaning of section 1387. One decision has stated that this is the case, and others have assumed that it is so without discussion. (Dunn v. Superior Court, supra, 159 Cal. App.3d at p. 1119; see People v. Luna, supra, 140 Cal. App.3d at p. 792 [equating "refusing to hold" with dismissal]; Lee v. Superior Court, supra, 142 Cal. App.3d at p. 639 [equating a finding of "insufficient evidence to bind over" with dismissal].)
(2b) It follows that defense counsel should have moved to dismiss, pursuant to section 1387, and that his failure to do so deprived petitioner of effective assistance of counsel. (People v. Horning, supra, 150 Cal. App.3d at pp. 1022-1023; People v. Fosselman (1983) 33 Cal.3d 572 [189 Cal. Rptr. 855, 659 P.2d 1144].)[5]
The petition for writ of habeas corpus is granted, and the judgment (order granting probation) is set aside.
White, P.J., and Scott, J., concurred.
Respondent's petition for a hearing by the Supreme Court was denied May 2, 1985.
NOTES
[1]  All further statutory references are to the Penal Code.
[2]  All dates are in the year 1982 unless otherwise indicated.
[3]  The facts of the offense are not relevant to this proceeding. In essence, the evidence showed that the victim of the burglary left her apartment in the company of a group which included petitioner, who was known to her. A few minutes later the victim returned to retrieve something she had forgotten and found that her apartment had been broken into and her fur coat stolen. The victim asked petitioner's help in recovering the coat. The next day the victim received the coat from petitioner, who said that he had bought the coat from "some guy" for $20.
[4]  The history of the 1980 legislation which conferred on magistrates the power to dismiss actions so as to bar further prosecution has been repeatedly stated and need not be iterated here. (E.g., Ramos v. Superior Court (1982) 32 Cal.3d 26, 30 [184 Cal. Rptr. 622, 648 P.2d 589]; People v. Luna (1983) 140 Cal. App.3d 788, 792 [189 Cal. Rptr. 792].)
[5]  Trial counsel informed petitioner's counsel on appeal that his review of the file revealed no tactical reason for failing to make a section 1387 motion.
