California Penal Code

1385. (a) The judge or magistrate may, either of his or her own motion or upon the application of the prosecuting attorney, and in furtherance of justice, order an action to be dismissed. The reasons for the dismissal must be set forth in an order entered upon the minutes. No dismissal shall be made for any cause which would be ground of demurrer to the accusatory pleading.

(b) This section does not authorize a judge to strike any prior conviction of a serious felony for purposes of enhancement of a sentence under Section 667.