
270 Kan. 847 (2001)
19 P.3d 167
MELISSA R. PETTY, Appellee/Cross-appellant,
v.
CITY OF EL DORADO, KANSAS, and MICHAEL G. COASH, Appellants/Cross-appellees.
No. 84,665.
Supreme Court of Kansas.
Opinion filed March 9, 2001.
Michael G. Coash, of El Dorado, was on the brief for appellants/cross-appellees.
Darren K. Patterson, of El Dorado, argued the cause and was on the brief for appellee/cross-appellant.
*848 The opinion of the court was delivered by
LOCKETT, J.:
The City of El Dorado (City) appeals the district court's determination that the provision of a municipal diversion agreement requiring a defendant to serve time in the county jail was void because the City lacked statutory authority to require jail time as a condition of the diversion agreement. The defendant cross-appealed the district court's application of equitable estoppel and its finding that the entire diversion agreement was illegal and void and returning the parties to their preagreement status.
The City created a pretrial diversion program for first-time DUI offenders. The statutory eligibility requirements that govern acceptance into the program, and requirements that must be fulfilled by those accepted into the program, are discussed below. The City amended its diversion requirements, effective February 1, 1997, to include the condition that an individual granted diversion for DUI serve either 48 or 72 hours in the Butler County jail. The number of hours spent in the jail depends on the defendant's blood alcohol level at the time of arrest.
On August 15, 1998, Melissa Petty was charged in El Dorado Municipal Court with operating a motor vehicle under the influence of alcohol (DUI). Petty made a written application for acceptance into the City's DUI diversion program. On December 18, 1998, Petty signed a written diversion agreement with the City which required that she serve 48 hours in the Butler County jail within the subsequent 120 days.
On April 23, 1999, Petty filed for an injunction in the district court against the City, seeking a temporary restraining order and declaratory relief. In her petition for an injunction, Petty claimed the City had no statutory authority to require her to serve 48 hours in jail as condition of the diversion agreement. The district court granted the temporary restraining order and set the matter for hearing.
On August 6, 1999, at the hearing for a permanent injunction, the district court heard testimony and oral arguments. Petty testified that when she entered into the diversion agreement, she had intended to serve the 48 hours in jail as required by the agreement.
*849 Petty again contended the city attorney had no statutory authority to require jail time as a condition of the diversion agreement and requested that the City be enjoined from enforcing that condition. The City argued that (1) it had statutory authority to require jail time and (2) the doctrine of equitable estoppel precluded Petty from raising that issue.
The district judge in a memorandum opinion noted that the 1978 Kansas Special Legislative Committee on Corrections issued a report recommending the enactment of a district court pretrial diversion procedure substantially similar to the municipal diversion procedure. The district judge pointed out that the report indicated that the legislature's purpose in providing for diversion agreements was to offer the offender an alternative method of rehabilitation other than incarceration or probation, which will bring about the offender's future compliance with the law. Report on Kansas Legislative Interim Studies to the 1978 Legislature, Special Committee on Corrections, p. 48. The report also stated: "The Committee has examined the pretrial diversion approach and believes that such a program should be available in Kansas to reduce the number of persons committed to institutions, in those cases where diversion would be in the interests of justice and of benefit to the defendant and the community." (Emphasis added.) Report, pp. 48-49. The report further stated: "The Committee believes that a pretrial diversion mechanism should be available in Kansas to be used, in some cases, as an alternative to the traditional dispositions of incarceration or probation." (Emphasis added.) Report, p. 49.
Based on these findings, the district court enjoined the City from enforcing the jail time provision in the diversion agreement and then, following contract law, set aside the diversion agreement and returned the parties to their prediversion agreement status. The City appealed, claiming that the district judge's conclusions were erroneous. Petty cross-appealed the judge's order voiding the agreement. The case was transferred to this court pursuant to K.S.A. 20-3018(c).
Did the district court err in holding that the City did not have the authority to require jail time as a condition of diversion? If the City exceeded its statutory authority, does the doctrine of equitable *850 estoppel apply to the diversion agreement? The issues presented are questions of law to be decided upon uncontroverted facts. Our standard of review is plenary and unlimited. See Matney v. Matney Chiropractic Clinic, 268 Kan. 336, 338-39, 995 P.2d 871 (2000).

Statutes
Municipal court diversion in a criminal case charging an alcoholrelated offense is the referral of a defendant to a supervised performance program prior to adjudication. K.S.A. 12-4413(c). A diversion agreement is the specification of formal terms and conditions which a defendant must fulfill in order to have the charges against the defendant dismissed. K.S.A. 12-4413(d).
K.S.A. 12-4416(a) provides requirements which must be included in every diversion agreement, namely: a waiver of all rights to counsel, a speedy arraignment, a speedy trial, and a trial by jury; (2) a stipulation of the facts upon which the charge is based and a provision that if the defendant fails to fulfill the terms of the diversion agreement further proceedings shall be conducted on the record of the stipulation of facts; (3) the payment of a fine or the performance of community service; (4) enrollment in and completion of an alcohol drug safety action or treatment program. Diversion agreements may include, but are not limited to: (1) the payment of court costs, restitution, and diversion costs; (2) residence in a specified facility; (3) maintenance of gainful employment; and (4) participation in programs offering medical, educational, vocational, social, and psychological services, corrective and preventive guidance, and other rehabilitative services.
The City points out that K.S.A. 12-4416 states that the diversion agreement may include a provision for residence in a specified facility. The City asserts that it is that provision that allows its city attorney to include a condition of time in jail, i.e., a specified residential facility. Petty argued to the district court and to this court that the legislature contemplated placement in a residential facility for education or rehabilitation, not time in jaila punishment. Petty asserts that requiring a person to spend time in jail as a condition of the diversion agreement violates the legislature's policy of diversion.
*851 The rules regarding statutory ambiguity state that if a statute is plain and unambiguous, the courts must give effect to the expressed statutory language. In re Tax Appeal of Boeing Co., 261 Kan. 508, Syl. ¶ 7, 930 P.2d 1366 (1997). A statute is ambiguous when two or more interpretations can fairly be made. Sterling Drilling Co. v. Kansas Dept. of Revenue, 9 Kan. App.2d 108, 109, 673 P.2d 456 (1983), rev. denied 234 Kan. 1078 (1984). Two distinct interpretations of K.S.A. 12-4416 are advanced by the parties. Therefore, it is appropriate to consider legislative intent.
In State v. Booze, 238 Kan. 551, 712 P.2d 1253 (1986), the Booze court, in determining the legislative intent for sentencing a second offender, reviewed the legislative history of statutory diversion provisions, considered the nature of diversion agreements, and observed that a defendant entering into a diversion agreement could waive his or her constitutional right to due process. The Booze court deduced: "The only real difference between diversion and being sentenced as a first offender (K.S.A. 1983 Supp. 8-1567[c]) is the incarceration." 238 Kan. at 555. The Booze court concluded that a repeat violator of the DUI law was subject to sentence enhancement on a second offense regardless of whether the individual was sentenced to jail or received diversion for the first offense. Although the issue in Booze was not whether jail time could be part of a diversion agreement, the court's language assumes that time served in jail is antithetical to diversion. See State v. Clevenger, 235 Kan. 864, 683 P.2d 1272 (1984).
In State v. Wright, 54 Wash. App. 638, 774 P.2d 1265 (1989), the Washington court considered whether the Washington deferred prosecution statute, which is similar to the Kansas diversion statute, permitted a 10-day jail term as a condition of deferred prosecution. Noting that deferred prosecution is a creature of statute, the Washington court determined that the trial court's authority to impose conditions of deferred prosecution must be authorized by statute. 54 Wash. App. at 639-60. The Washington court noted that its legislature's stated intent in enacting deferred prosecution was to provide an alternative to punishment for persons who would benefit from a treatment program. The Washington court stated: "We fail to see how the imposition of punishment, *852 as a condition of deferred prosecution, can be reconciled with the express statement of the Legislature that deferred prosecution is an alternative to punishment." 54 Wash. App. at 640.
The Kansas legislative history of its diversion provisions is similar to the Washington legislative history of its deferred prosecution statutes. The legislative history supports the district court's conclusion that diversion is an alternative rather than a supplement to the traditional dispositions of incarceration or probation. Placing an individual in a specified facility under K.S.A. 12-4416(a) provides an alternative to punishment for persons who would benefit from a treatment program in a specified residential facility.
We will now construe the municipal judge's authority to commit individuals who have entered into diversion agreements requiring the individuals to serve jail time. In construing statutes and determining legislative intent, several provisions of an act or acts, in pari materia, must be construed together with a view of reconciling and bringing them into workable harmony if possible. State v. Bolin, 266 Kan. 18, 24, 968 P.2d 1104 (1998).
The authority of municipal judges to commit persons to jail is found in K.S.A. 2000 Supp. 12-4106 and K.S.A. 2000 Supp. 12-4509. K.S.A. 2000 Supp. 12-4106 provides that the municipal judge may commit persons to jail for contempt of court, failure to obey process, being found guilty of violating a city ordinance, or defaulting on a pretrial bond condition. K.S.A. 2000 Supp. 12-4509 provides that whenever a person is found guilty of a violation of an ordinance, the municipal judge may impose a sentence of fine or imprisonment or both, as authorized by the ordinance violation. When a sentence of imprisonment is pronounced, the municipal judge or the clerk of the municipal court shall prepare and deliver to the chief of police a copy of the entry of judgment, duly certified by the judge or clerk, which provides authority to the chief of police to execute the sentence and confine the accused person to jail. K.S.A. 12-4510.
A diversion agreement is the specification of formal terms and conditions which a defendant must fulfill in order to have the charges against such defendant dismissed. Diversion is, therefore, a means to avoid a judgment of criminal guilt. See K.S.A. 12-4413.
*853 Inasmuch as no judgment of guilt is entered when diversion is granted, the district court was correct in finding that the municipal court judge had no authority to order Petty to a period of jail confinement as a condition of diversion.

PLAINTIFF'S CROSS-APPEAL
In declaring the diversion agreement void, the district court relied upon equitable estoppel and the general principle of contract law that a party to an illegal agreement will not be permitted to avail himself or herself of its illegality until he or she restores to the other party all that has been received from such a party as the result of the illegal agreement. So long as he or she continues to enjoy the benefits of the agreement, the party will not be allowed to set up its nullity. The district judge concluded that because the agreement was against public policy, the parties should be restored to their preagreement status. Petty contends that the district court erred in applying equitable estoppel and in voiding the entire diversion agreement as an illegal contract to restore the parties to their original positions.
Equitable estoppel is the effect of the voluntary conduct of a party whereby the party is precluded, both at law and in equity, from asserting rights against another party relying on such conduct. A party asserting equitable estoppel must show that another party, by its acts, representations, admissions, or silence when it had a duty to speak, induced it to believe certain facts existed. It must also show it rightfully relied and acted upon such belief and would now be prejudiced if the other party were permitted to deny the existence of such facts. Lines v. City of Topeka, 223 Kan. 772, Syl. ¶ 4, 577 P.2d 42 (1978) (following United American State Bank & Trust Co. v. Wild West Chrysler Plymouth, Inc., 221 Kan. 523, 561 P.2d 792 [1977]).
An illegal contract is a promise that is prohibited because the performance, formation, or object of the agreement is against the law. Black's Law Dictionary 322 (7th ed. 1999).
Petty points out that she fulfilled all the legal provisions of the diversion agreement, including the payment of fines and fees and attendance in drug and alcohol programs. Petty asserts that the *854 diversion agreement she entered into, without the jail time provision, is not an illegal contract and complies with the requirements of K.S.A. 12-4413 et seq. Petty asserts that under these circumstances, equitable estoppel does not apply and this court should strike the jail time provision of the agreement and give effect to the remaining provisions in the diversion agreement.
The public policy of a state is the law of that state as found in its constitution, its statutory enactments, and its judicial decisions. McAllister v. Fair, 72 Kan. 533, 540, 84 Pac. 112 (1906). Contracts in contravention of public policy are void and unenforceable. See Hunter v. American Rentals, 189 Kan. 615, 619, 371 P.2d 131 (1962). However, it is the duty of the courts to sustain the legality of contracts in whole or in part when possible. Foltz v. Struxness, 168 Kan. 714, Syl. ¶ 5, 215 P.2d 133 (1950). Courts are not to hold a entire contract void as contrary to statute unless the legislature so intended. See Bemis v. Becker, 1 Kan. 217, Syl. ¶ 9 (1862). When public policy touching on a particular subject has been declared by statute, courts may, under certain circumstances, void only those portions of an agreement which is in part a violation of the intent of the legislature and uphold the provisions in conformity with legislative intent. See Miller v. Foulston, Siefkin, Powers & Eberhardt, 246 Kan. 450, 462-63, 790 P.2d 404 (1990). The district judge was correct in finding that the provision of the diversion agreement requiring Petty to serve jail time violates the intent of the legislature and is void. The district judge erred in voiding the portions of the diversion agreement that followed the intent of the legislature.
Affirmed in part and reversed in part.
