delivered the Opinion of the Court.
¶1 Justin Allen Cleveland appeals the judgment of the Thirteenth Judicial District Court, Yellowstone County, sentencing him to a three-year suspended sentence, a fine, and participation in Adult Impaired Driving Court upon his guilty pleas to felony criminal endangerment, driving under the influence of alcohol, and operating a motor vehicle as a habitual traffic offender. We affirm.
¶2 The issues on appeal are as follows:
1. Whether Cleveland’s felony criminal endangerment charge qualified as an exception to the prior felony conviction rule, allowing him to receive a deferred sentence.
2. Whether Cleveland was entitled to specific performance of the original plea agreement that recommended a three-year deferred sentence, when he had a prior felony conviction that was not discovered until after the plea agreement was executed.
PROCEDURAL AND FACTUAL BACKGROUND
¶3 On October 25,2012, Cleveland was observed driving erratically at 99 miles per hour in a 75-mile-per-hour zone. After being pulled over, Cleveland was found to be under the influence of alcohol. Cleveland’s six-month-old child, O.C., was in the vehicle.
¶4 Cleveland was charged by information on November 2,2012, with one felony count of criminal endangerment, and three misdemeanors: (1) driving under the influence of alcohol, (2) being a habitual traffic offender operating a motor vehicle, and (3) operating a motor vehicle with plates assigned to another vehicle.
*99¶5 On April 5,2013, Cleveland signed an acknowledgement of waiver of rights and plea agreement, in which he pled guilty to the charges of criminal endangerment, driving under the influence, and being a habitual traffic offender operating a motor vehicle. The State agreed to move to dismiss the charge of operating a motor vehicle with plates assigned to another vehicle. The plea agreement recommended a $500 fine, and a three-year deferred sentence on the condition that Cleveland complete the Adult Impaired Driving Court.
¶6 On June 4,2013, the District Court held Cleveland’s sentencing hearing at which the State presented a modification to Cleveland’s recommended sentence because it discovered in his pre-sentence report that Cleveland had a prior felony which precluded him from receiving a deferred sentence under § 46-18-201(l)(b), MCA. Because of this discovery, the State recommended Cleveland receive a suspended sentence instead of a deferred sentence. Alternatively, the State agreed that Cleveland should have the opportunity to withdraw his guilty plea.
¶7 Cleveland argued that he was still eligible for a deferred sentence under an exception to the prior felony conviction rule, § 46-18-222(5), MCA, and that he was entitled to specific performance of the plea agreement. However, the District Court ruled that the exception to the prior felony conviction rule under § 46-18-222(5), MCA, did not apply to Cleveland’s case. Having determined that Cleveland was not statutorily eligible for a deferred sentence under § 46-18-201(l)(b), MCA, the District Court refused to grant Cleveland specific performance of the plea agreement.
¶8 The District Court issued a sentencing order on July 10,2013, in which it sentenced Cleveland to a three-year suspended sentence with credit for time served, a $500 fine, and participation in the Adult Impaired Driving Court on the charges of felony criminal endangerment, driving under the influence of alcohol, and being a habitual traffic offender operating a motor vehicle.
¶9 Cleveland appeals the District Court’s July 10,2013 sentencing order.
STANDARD OF REVIEW
¶10 This Court reviews a criminal sentence only for legality (i.e., whether the sentence is within the parameters provided by statute). State v. Montoya, 1999 MT 180, ¶ 15, 295 Mont. 288, 983 P.2d 937.
*100DISCUSSION
¶11 1. Whether Cleveland’s felony criminal endangerment charge qualified as an exception to the prior felony conviction rule, allowing him to receive a deferred sentence.
¶12 Section 46-18-201(l)(b), MCA, states: “Except as provided in 46-18-222, imposition of sentence in a felony case may not be deferred in the case of an offender who has been convicted of a felony on a prior occasion.” Relevant to the present dispute is the exception set forth at §46-18-222(5), MCA, which provides in pertinent part that a defendant qualifies for a subsequent deferred sentence “in a case in which the threat of bodily injury or actual infliction of bodily injury is an actual element of the crime, [but] no serious bodily injury was inflicted on the victim unless a weapon was used in the commission of the offense.” ¶13 Cleveland argues that his crime should be included in the exception to the prior felony conviction rule because criminal endangerment is a crime in which the risk of bodily injury is an element, § 45-5-207, MCA, but no bodily injury actually occurs. Section 46-18-222(5), MCA. The State disagrees, arguing that this exception only applies to violent crimes involving the “threat” of bodily injury, § 46-18-222(5), MCA, whereas criminal endangerment involves the “risk” of bodily injury pursuant to § 46-5-207, MCA. Essentially, the State argues that as used in these respective statutes, “threat” and “risk” are not synonymous. We agree.
¶14 Section 45-2-101(76Xa), MCA, defines “threat” as “a menace, however communicated, to ... inflict physical harm on the person threatened or any other person or on property.” By contrast, a “risk” is defined as “someone or something that creates or suggests a hazard.” Merriam-Webster’s Collegiate Dictionary 1076 (Frederick C. Mish ed., 11th ed. 2012). Plainly, a “threat” of bodily injury, § 46-18-222(5), MCA, is not synonymous with a “risk” of bodily injury as used in § 45-5-207, MCA. A threat involves an affirmative act in which the actor communicates a menace to inflict harm. Section45-2-10H76X&), MCA. As used in § 45-5-207, MCA, “risk” is the possibility of death or injury resulting from a hazard created by the defendant. Relevant to the present case, Cleveland obviously did not “threaten” to inflict harm upon his six-month-old child. He did, however, create a hazard from which harm to the child may have resulted by driving under the influence.
¶15 It may seem incongruous that arguably more serious offenses may qualify for an exception to the prior felony conviction rule under § 46-18-222(5), MCA, while criminal endangerment pursuant to § 45-5-*101207, MCA, does not. Nevertheless, Cleveland’s offense clearly did not qualify for the recommended deferred sentence in the original plea agreement.
¶16 2. Whether Cleveland was entitled to specific performance of the original plea agreement that recommended a three-year deferred sentence, when he had a prior felony conviction that was not discovered until after the plea agreement was executed.
¶17 “Plea bargaining agreements are subject to contract law standards.” State v. Dinndorf, 202 Mont. 308, 311, 658 P.2d 372, 373 (1983). In State v. Allen we noted:
Prosecutors who engage in plea bargaining must meet strict and meticulous standards of both promise and performance as a plea of guilty resting in any significant degree on an unfulfilled plea bargain is involuntary and subject to vacation. Prosecutorial violations, even if made inadvertently or in good faith to obtain a just and mutually desired end, are unacceptable.
State v. Allen, 199 Mont. 204, 209, 645 P.2d 380, 382 (1981) (citations omitted).
¶18 A contract is unlawful if it is “contrary to an express provision of law.” Section 28-2-701(1), MCA. If a contract has several distinct objects, and at least one object is lawful and one is unlawftd, then “the contract is void as to the latter and valid as to the rest.” Section 28-2-604, MCA.
¶19 As discussed above, Cleveland was not eligible for a deferred sentence because of his prior felony conviction. The State argues, therefore, that there was no breach of the plea agreement because the agreement was voided by the illegal provision — i.e., the deferred sentence, citing § 28-2-701, MCA, and § 28-2-603, MCA. Cleveland argues that the State should have allowed him to nevertheless choose between specific performance of the plea agreement or withdrawal of his guilty plea, relying on State v. Munoz, 2001 MT 85, 305 Mont. 139, 23 P.3d 922; and State v. Rardon, 2002 MT 345, 313 Mont. 321, 61 P.3d 132 (Rardon IT).
¶20 In Munoz, the defendant pled guilty to one count of sexual assault, and entered a plea agreement for a three-year sentence. Munoz, ¶¶ 3-4. However, at the sentencing hearing the prosecution urged the District Court to adopt the probation officer’s recommendation of a five-year sentence. Munoz, ¶ 5. The District Court sentenced him to five years, and ordered that Munoz would be ineligible for parole until he completed every phase of the prison’s sex offender treatment program. Munoz, ¶ 6. Munoz moved to withdraw his guilty plea because the *102State breached the plea agreement, but his motion was denied. Munoz, ¶¶ 7-8.
¶21 On appeal, we held that because the State breached the plea agreement, Munoz should have been allowed to choose from available remedies as the non-breaching party. Munoz, ¶¶ 10, 38. The burden then fell on the State, as the breaching party, to show by clear and convincing evidence that the defendant’s choice of remedy would result in a miscarriage of justice. We therefore held that Munoz should have been given the option to withdraw his guilty plea. Munoz, ¶ 38. In Eardon II, we gave the defendant the option to withdraw his guilty plea or obtain specific performance of his plea agreement after the state breached the plea agreement. Eardon II, ¶ 26.
¶22 Cleveland’s caséis distinguishable from Munoz and Eardonll because the terms of Cleveland’s plea agreement were illegal under § 46-18-201(l)(b), MCA, due to Cleveland’s prior felony conviction which made him ineligible to receive a deferred sentence. Because that provision of the original plea agreement was illegal, the object of the plea agreement — the deferred sentence — was void and unenforceable. Sections 28-2-701, -604, MCA.
¶23 We reiterate that the State has an obligation to “meet strict and meticulous standards of both promise and performance” when engaged in plea bargaining and that “[pjrosecutorial violations, even if made inadvertently or in good faith to obtain a just and mutually desired end, are unacceptable.” Allen, 199 Mont, at 209, 645 P.2d at 382. However, these obligations cannot include the enforcement of an illegal, and therefore unenforceable, provision. Therefore, Cleveland was not entitled to specific performance of the plea agreement, and the State correctly gave him the option to either withdraw his guilty plea or agree to the suspended sentence in accordance with § 46-18-201(lXb), MCA.
¶24 Affirmed.
JUSTICES WHEAT, BAKER and RICE concur.