The Preprosecution Diversion Act, NMSA 1978, Sections 31-16A-1 through 31-16A-8 (Cum.Supp.1983), provides that a person, alleged to have committed a crime, may be diverted “into the preprosecution diversion program and criminal proceedings against the defendant shall be suspended.” Section 31-16A-6(B). The Act contemplates a successful termination of a diversion program, see Section 31-16A-8(B), and impliedly, but not specifically, provides that a prosecution is barred if a diversion program is successfully terminated. The Act deals specifically with an unsuccessful termination in Section 31-16A-7 as follows:
B. If a defendant does not comply with the terms, conditions and requirements of a preprosecution diversion program, his participation in the program shall be terminated, and the district attorney may proceed with the suspended criminal prosecution of the defendant.
C. If the participation of a defendant in a preprosecution diversion program is terminated, the district attorney shall state in writing the specific reasons for the termination, which reasons shall be available for review by the defendant and his counsel.
This case involves an alleged unsuccessful termination. The prosecutor was of the view that defendant had failed to comply with the diversion program. He terminated the diversion and filed an information charging defendant, in two counts, with receiving stolen property. NMSA 1978, § 30-16-11 (Cum.Supp.1983). Defendant sought dismissal of the charges, contending that the prosecutor’s termination of defendant’s diversion program was invalid. Defendant affirmatively alleged that he had substantially complied with the terms of the diversion agreement that he signed and with his preprosecution probation. The trial court conducted an evidentiary hearing. The evidence supported defendant’s claim that defendant had not violated his diversion agreement. However, the trial court did not decide the factual question of whether defendant had violated the diversion agreement. The trial court denied the motion to dismiss; it stated orally that (1) the statute provides for unilateral termination, and (2) “[t]his Court has nothing to do with it.”
Defendant then pleaded no contest on the basis of an agreement with the prosecutor which was brought to the attention of the trial court. The agreement was that defendant was not waiving his claim that his diversion program had been improperly terminated. A judgment of conviction and sentence was entered on the basis of the no contest plea. Defendant appeals.
Defendant contends: (1) the prosecutor’s termination of defendant from the diversion program deprived defendant of due process, and (2) the termination provi*545sion of Section 31-16A-7(B) and (C), quoted above, lacks standards, guidelines and restrictions and, thus, violates the doctrine of separation of powers. The State concedes that there should be a procedure to protect a defendant against an arbitrary termination of a diversion program. In violation of a long-standing rule, see Strickland v. Roosevelt County Rural Electric Cooperative, 99 N.M. 335, 657 P.2d 1184 (Ct.App.1982), the State attaches to its brief materials allegedly representative of preprosecution programs in several judicial districts which, according to the State, “show considerable variation from program to program.” None of this material was presented to the trial court. The State then outlines the procedure and the extent of judicial review it considers sufficient to meet minimal requirements of due process and asks this Court to adopt them. The trial court’s ruling and the statutory provisions are only incidentally involved in the State’s argument. We limit our consideration to the record of the trial court proceedings and the issues raised in the trial court. NMSA 1978, Crim., Child.Ct., Dom.Rel. & W/C App.R. 308 (Repl.Pamp.1983); see State v. Duran, 91 N.M. 756, 581 P.2d 19 (1978).
On the other hand, defendant’s brief also hurries to discuss the case in terms of constitutional requirements without considering the issue litigated in the trial court and the trial court’s ruling. The issue litigated was (1) that defendant had not violated his diversion agreement and the prosecutor’s termination of the agreement was wrongful; and (2) it would be a violation of due process if the factual question of whether a violation occurred could not be considered by the trial court. These contentions were presented as a defense barring the criminal prosecution. The arguments in defendant’s brief as to a hearing prior to a termination and the requirements of such a hearing involve constitutional issues that will not be discussed in deciding this case. They were neither raised in nor decided by the trial court. See St. Vincent Hospital v. Salazar, 95 N.M. 147, 619 P.2d 823 (1980); Adoption of Doe, 89 N.M. 606, 555 P.2d 906 (Ct.App.1976).
Inasmuch as we decide this case on the basis of issues litigated and decided by the trial court, we do not consider the applicability of the following cases to the New Mexico preprosecution diversion program: Meachum v. Fano, 427 U.S. 215, 96 S.Ct. 2532, 49 L.Ed.2d 451 (1976); Wolff v. McDonnell, 418 U.S. 539, 41 L.Ed.2d 935, 94 S.Ct. 2963 (1974); Gagnon v. Scarpelli, 411 U.S. 778, 93 S.Ct. 1756, 36 L.Ed.2d 656 (1973); Morrissey v. Brewer, 408 U.S. 471, 92 S.Ct. 2593, 33 L.Ed.2d 484 (1972); State v. Lebbing, 158 N.J.Super. 209, 385 A.2d 938 (1978); Pannell v. Jones, 36 N.Y.2d 339, 368 N.Y.S.2d 467, 329 N.E.2d 159 (1975); State ex rel. Harmon v. Blanding, 292 Or. 752, 644 P.2d 1082 (1982).
Section 31-16A-7(B) and (C) provides that the prosecutor may terminate defendant’s participation in a diversion program “[i]f a defendant does not comply with the terms, conditions and requirements of a preprosecution diversion program * * *.” A similar provision was included in the written agreement signed by defendant, defendant’s attorney and the district attorney.
The agreement provides:
F. During the first year of his probation, the defendant shall perform five hundred (500) hours of community service as designated by the Adult Probation Officer and agreed to by the District Attorney, provided, however, that if Defendant is transferred out of the Grant County area for employment purposes this condition will be deemed satisfied at the time of transfer.
On September 7, 1982 the district attorney wrote to defendant: “I am as of this date terminating your Preprosecution Agreement and reinstating the criminal case against you.” The reason stated, see Section 31-16A-7(C), was defendant’s failure to perform community service or make arrangements to start community service. This letter made no mention of the proviso quoted above.
On September 15, 1982 the district attorney again wrote to defendant. This letter states that defendant was acting in bad *546faith and was attempting to escape the requirement of community service by reliance on the proviso quoted above.
[B]oth probation officers have informed me that you have never requested permission to go to Ruidoso to obtain work nor did you ever inform them of that fact, nor were they aware that you, in fact, are working in Ruidoso * * *. Therefore, my letter of September 7,1982 * * * remains in full force and effect.
Testimony at the evidentiary hearing indicates the prosecutor was misinformed. The chief adult probation officer, Mr. Ortiz, testified that his office provided only “courtesy” supervision of participants in the diversion program and' kept no records concerning the participants. Ortiz could only recollect that he had spoken to defendant on one occasion, but could not remember what the conversation was about. However, Ortiz’ secretary testified that she had seen defendant in the office six or eight times; that in August 1982 defendant had spoken to Ortiz about going to Ruidoso to work and she filled out a travel permit authorizing this travel, but this permit was never signed. Defendant testified that he had spoken to Ortiz about going to work in either Carrizozo or Ruidoso and was informed by Ortiz that no travel permit was necessary. Defendant also testified that according to Ortiz the community service requirement did not have to be fulfilled after defendant left town to work elsewhere. The testimony of the secretary and defendant raise a factual question of compliance with the agreement; no substantial contradicting evidence is identified by the State.
As the trial court correctly observed, Section 31-16A-7(B) and (C) provides for a unilateral termination by the prosecutor. We need not consider the constitutionality of such a termination because the prosecutor’s authority to unilaterally terminate is limited in this case, both by the statute and the written agreement, to a termination on the basis of defendant’s noncompliance with the diversion program.
The prosecutor’s statutory authority was to terminate the agreement for noncompliance. A prosecutor has a duty to conduct himself fairly; “their methods must accord with the fair and impartial administration of justice.” State v. Payne, 96 N.M. 347, 630 P.2d 299 (Ct.App.1981), overruled on other grounds, Buzbee v. Donnelly, 96 N.M. 692, 634 P.2d 1244 (1981); see also State v. Hill, 88 N.M. 216, 539 P.2d 236 (Ct.App.1975). If in fact the prosecutor terminated the diversion agreement in violation of his statutory authority, the prosecutor did not proceed fairly.
The diversion agreement required defendant to give a taped statement to the police and required defendant to agree “that in the event that he [defendant] should violate the terms and conditions of this Agreement that the taped statement may be introduced in evidence against him in any subsequent case.” Defendant having given up his right not to be a witness against himself, the “appropriate relief within the dictates of due process” is to require the prosecutor to keep his promise and terminate the agreement only if defendant has failed to comply with the agreement. State ex rel. Plant v. Sceresse, 84 N.M. 312, 502 P.2d 1002 (1972). See Village of Ruidoso v. Rush, 97 N.M. 733, 643 P.2d 297 (Ct.App.1982); State v. Session, 91 N.M. 381, 574 P.2d 600 (Ct.App.1978); State v. Lord, 91 N.M. 353, 573 P.2d 1208 (Ct.App.1977); State v. Plant, 86 N.M. 2, 518 P.2d 961 (Ct.App.1973).
Under both the statute and the written agreement there is a factual predicate for termination of the diversion agreement. That predicate is defendant’s compliance with the agreement. The trial court observed that the statute did not authorize a hearing on the question of compliance but, nevertheless, held an evidentiary hearing. After the hearing, the trial court commented that the court had nothing to do with the agreement or its termination. This was incorrect. It is established New Mexico law that the trial court may determine what, if anything, was agreed upon, and whether the prosecutor had kept his agreement. The trial court may require the *547prosecutor to keep his end of the agreement. State ex rel. Plant v. Sceresse; State v. Session; see State v. Lord and State v. Plant. On the same basis, the dictates of due process, the trial court could determine whether the prosecutor had terminated the preprosecution diversion agreement in violation of his statutory authority.
This determination may be made by the trial court when the broken promise or statutory violation is raised as a defense to a criminal prosecution. State ex rel. Plant v. Sceresse; State v. Session; State v. Plant. This defense goes to the initiation of the prosecution and must be raised prior to trial. NMSA 1978, Crim.P.R. 33(c)(1) (Cum.Supp.1983); Rogers v. State, 94 N.M. 218, 608 P.2d 530 (Ct.App.1980). It is to be decided by the trial court inasmuch as it does not involve a trial on the merits of the criminal charge. Rogers v. State; State v. Mares, 92 N.M. 687, 594 P.2d 347 (Ct.App.1979).
The order denying defendant’s motion to dismiss is reversed. The cause is remanded with instructions to the trial court to decide the factual question of whether defendant failed to comply with the diversion agreement, and the correlate, whether the prosecutor terminated defendant’s diversion from prosecution in violation of Section 31-16A-7(B) and (C). The trial court’s decision is to be based on the present record, without hearing additional evidence. The judgment and sentence are vacated pending a trial court decision pursuant to the foregoing instructions. If it is determined that defendant was improperly terminated, the prosecution was barred and the trial court should dismiss the prosecution on which the appeal is based.
IT IS SO ORDERED.
DONNELLY and BIVINS, JJ., concur.