The opinion of the court was delivered by
Harvey, J.:This is an appeal from an order of'prohibition made by the district court of Montgomery county directed to the court of Coffeyville and A. A. Baker, its judge, restraining and prohibiting defendant from trying a misdemeanor case pending in that court.
The jurisdiction of the court of Coffeyville in criminal cases is the same as that of justices of the peace (R. S. 20-1603) ,,that is, it has concurrent original jurisdiction with the district court in misdemeanor cases (R. S. 63-101).
On March 19,1927, the county attorney prepared and filed in the court of Coffeyville a complaint charging H. G. .Beatty with unlawful assembly, a misdemeanor (R. S. 21-1001). A warrant was duly issued, Beatty was arrested and brought into court. He gave bond' for his appearance the date set for trial. On March 26, 1927, the county attorney of Montgomery county appeared in the court of Coffeyville and orally moved and directed the court to dismiss the cáse, and on the same day, or the next, the county attorney filed an information in the district court of Montgomery county charging Beatty with the same offense previously charged in the court of Coffeyville. The judge of the court of Coffeyville declined to make an order dismissing the case in that court. On April 2, 1927, the, county attorney filed in the court of Coffeyville a written motion in the case there pending wherein he moved and directed the court of Coffeyville to dismiss the case at the cost of the state. On April 5,1927, Beatty filed, in his case in the court of Coffeyville, a motion asking the court to set the case for hearing before a jury. The motion was by the court considered and sustained and the case was set for hearing in that court before a jury for the 12th day of April. On April 7, 1927, this action was brought to restrain and prohibit the court of Coffeyville and the judge thereof from proceeding with the trial of the case in that court. This case was heard by the district court, and on April 9 an order made prohibiting further pro*776ceedings in the case in the court of Coffeyville aiid adjudging to be null and void all proceedings in that court subsequent to April 2, 1927.
In support of the order appealed from it is contended that the county attorney had authority, for any reason which appeared to him to be sufficient, to appear in the court of Coffeyville and to dismiss the case there pending at any time before trial, and to file an information in the district court against the same defendant for the same offense. This contention must be sustained. It is made the duty of the county attorney to appear in the several courts of his county and prosecute or defend on behalf of the state all suits, applications, or motions, civil or criminal, arising under the laws of the state in which the state is a party. (R. S. 19-702.) When requested by the justice of the peace or the complainant he shall appear and prosecute all misdemeanors tried before a justice of the peace in his county (R. S. 63-505), and when requested by any magistrate he shall appear on behalf of the state before such magistrate and prosecute all complaints made on behalf of the state in which such magistrate shall have jurisdiction and conduct any criminal examination which, may be had before such magistrate. (R. S. 19-703.)
“A criminal prosecution is a state affair, and the control of it is in the public prosecutor.” (State v. Wilson, 24 Kan. 189, 192.)
“The law makes it the duty of the county attorney to conduct criminal prosecutions on behalf of the state, and all steps in the trial are alike under his supervision and control.” (State v. Wells, 54 Kan. 161, 165, 37 Pac. 1005.)
“No one but the county attorney,- or the attorney-general on proper occasion, or persons deputized by them, may control prosecutions within a county.” (State v. Snelling, 71 Kan. 499, 506, 80 Pac. 966.)
In the case of In re Broadhead, 74 Kan. 401, 405, 86 Pac. 458, it was stated:
“The county attorney is the representative of the state in criminal prosecutions, and, subject only to a limited direction by the court, controls such actions.”
In this case it was held that the sheriff was justified in acting on the advice of the county attorney to return a criminal warrant without serving the same. The effect of this was to end the prosecution.
In Foley v. Ham, 102 Kan. 66, 169 Pac. 183 (reported and annotated in L. R. A. 1918C, 204), a complaint, charging P. T. Foley with a felony, was filed with a justice of the peace, who issued a *777warrant upon which Foley was arrested. The county attorney then filed a written motion with a justice of the peace asking and undertaking to direct that the case be dismissed. The justice o'f the peace overruled the motion. Foley then brought an action in the district court against the justice of the peace (and others) asking that further proceedings before the justice of the peace be forbidden. So far as it concerned the justice of the peace, the case amounted to an application for a writ'of prohibition, or for a judgment or order in the nature of such writ, forbidding the further proceedings in the criminal case, on the ground that the county attorney had full right to control the matter, and his direction for its dismissal should have been given effect.' The court held:
“While the county attorney is not required to take part in a preliminary examination in a felony case unless requested to do so by the magistrate, if he does appear he is entitled to have full charge of the prosecution, and the case should be dismissed if he so directs.
“Where a justice of the peace, sitting as an examining magistrate, refuses to dismiss a criminal prosecution on the motion of the county attorney, the district court, by an order in the nature of a writ of prohibition, may compel such action.
“Where a county attorney asks the dismissal of a criminal case pending before a justice of the peace, and his request is denied, no further challenge of the right of the justice to proceed therein is necessary to give a basis for asking relief by prohibition.” (Syl. ¶¶ 1,2,3.)
The case is directly in point here, for under R. S. 63-505 the county attorney has the same power and authority to direct and control the prosecution of a misdemeanor case before a justice of the peace that he has to direct and control a preliminary examination in a felony case, under R. S. 19-703.
Appellant argues that prohibition was not a proper remedy for the reason that the state might have had a change of venue under R. S. 63-313. The questions of the authority to grant a change of venue and of the authority of the prosecutor to control prosecutions are separate and distinct. Change of venue would be to another justice of the peace court and would depend upon a showing of prejudice, as provided in R. S. 61-701 et seq., and whether it is granted or not depends upon the showing made and the exercise of the judicial discretion of the court. (16 C. J. 201 et seq.) The dismissal or nolle -prosequi of the criminal action rests entirely within the discretion of the prosecuting officer (16 C. J. 434), except as that discretion may be limited by the statute. It is not contended that *778any statutory limitation applies to the discretion of the prosecuting officer in this case.
Appellant argues that, since the court of Coffeyville and the district court have concurrent jurisdiction in misdemeanor cases, and the court of Coffeyville first acquired jurisdiction, it should retain the jurisdiction throughout the trial, citing 15 C. J. 1134; Ewing v. Mallison, 65 Kan. 484, 70 Pac. 369, and allied cases, including State v. Chinault, 55 Kan. 326, 40 Pac. 662. But this rule never applies of course, when the case first brought is dismissed before trial.
The judgment of the court below is affirmed.