The district attorney is the public prosecutor, except as otherwise provided by law.
The public prosecutor shall attend the courts, and within his or her discretion shall initiate and conduct on behalf of the people all prosecutions for public offenses.