OPINION
We issued a writ of certiorari to the Court of Appeals to review that Court’s recognition of a limitation on the discretion of the trial court to impose additional incarceration after Jerome P. Mares violated the conditions of the probation awarded under a plea agreement with the State. The Court of Appeals held that, regardless of Mares’s probation violation, the trial court was limited by the plea agreement to impose a maximum of twenty-four-months incarceration. State v. Mares, 118 N.M. 217, 218, 880 P.2d 314, 315 (Ct.App.1994). Finding that the trial court did not err in concluding that the twenty-four-month cap was conditioned upon the satisfaction of probation conditions, we reverse the Court of Appeals and affirm the trial court.
Facts and proceedings. Mares was charged with two counts of trafficking cocaine under NMSA 1978, Section 30-31-20(A)(2) (Cum.Supp.1994). On December 2, 1992, Mares entered into a plea agreement under which he agreed to plead nolo contendere to one count of trafficking cocaine and the State agreed to dismiss the second count. The agreement also provided that Mares be sentenced to nine-years imprisonment but required that the sentence “be suspended such that there shall be no more than 24 months of potential actual incarceration ordered, with no fines.” The suspension was conditioned upon Mares accepting “probation for a period of 48 months.” Mares signed a statement that “I fully understand that if, as part of this agreement, I am granted probation, a suspended sentence or a deferred sentence by the Court, the terms and conditions thereof are subject to modification in the event that I violate any of the terms or conditions imposed.” Mares stated in open court that he had read the agreement and discussed it with his attorney.
The court accepted the agreement and imposed a sentence of nine-years incarceration, suspending all but seventy days and allowing work release. The court also placed Mares on forty-eight-months probation, imposed 240 hours of community service, required Mares to attend drug counselling, and required Mares to make a donation to the Tucumcari schools.
At the sentencing hearing on the plea agreement (not attended by Mares) defense counsel questioned the court about the period of incarceration facing Mares if he violated *50probation conditions. The trial court stated that the twenty-four-month sentencing cap was limited to the original proceedings and that a probation violation could result in nine-years incarceration. Mares’s counsel initially withheld his approval of the proposed judgment and sentence but eventually gave his approval. The judgment and sentence was entered on March 12, 1993, and incorporated the terms of the plea agreement. In addition, the judgment and sentence set conditions for probation, including a prohibition on the use of controlled substances, and stated that “if [Mares] violate[s] any of the above conditions of [his] Probation, the Court may revoke [Mares’s] probation or modify the conditions of [his] probation.”
On March 17 the State petitioned the court to revoke Mares’s probation, alleging that Mares had used cocaine while on work release. The State requested the court to incarcerate Mares for the entire nine years of his original sentence. On March 29 the trial court informed Mares that if he had violated the terms of his probation, the court could order him to serve the entire nine years of his original sentence plus two years probation. Mares did not object to the court’s statement.
On April 5 the State filed an amended motion to revoke probation and alleged that Mares had possessed and used illegally a prescription drug in addition to using cocaine. At the April 19 probation revocation hearing, Mares agreed not to contest the cocaine charge if the State abandoned the prescription drug charge. The trial court told Mares that by entering another plea agreement with the State he essentially was admitting his guilt. Mares stated that he understood the effects of the plea. After Mares stated that he had no further comment, the trial court accepted the State’s recommendation to sentence Mares to nine-years imprisonment.
Mares thereafter obtained new counsel and moved the trial court to reconsider the sentence and to enforce the original plea agreement. Mares argued it was his understanding that under the original plea agreement the trial court could not sentence him to more than twenty-four-months incarceration. Mares contended that his first attorney did not tell him that he could serve nine years if he violated probation. Further, Mares contended that he had asked his attorney about the twenty-four-month provision but his attorney did not answer his questions. Finally, Mares stated that, although he knew about the hearing held to clarify the issue of the period of incarceration he could face following a probation violation, his attorney did not tell him about the outcome of that hearing.
The trial court denied the motion to reconsider the sentence and Mares appealed to the Court of Appeals. That Court reversed the trial court’s ruling and held that Mares could be sentenced to no more than twenty-four-months imprisonment. 118 N.M. at 218, 880 P.2d at 315. The Court based this holding on its belief that the plea agreement was ambiguous as to whether the twenty-four-month cap pertained to initial sentencing only or controlled both initial sentencing and post-probation-violation sentencing. Id. at 222, 880 P.2d at 319. The Court held that the trial court could not consider extrinsic evidence to resolve an ambiguity by adding terms to a plea agreement and that any ambiguity in the plea agreement should be construed strictly against the State. Id. at 222-23, 880 P.2d at 319-20.
The trial court may enforce any valid plea agreement. The State argues that if the agreement was construed to require the trial court to impose no more than a twenty-four-month period of incarceration in the event of the revocation of probation, the agreement would force the court to impose an illegal sentence. It argues that a twenty-four-month sentence would be illegal because the sentence for a second-degree felony is nine years under NMSA 1978, Section 31-18-15(A)(3) (Repl.Pamp.1994). Thus, because “[a] trial court has no jurisdiction to impose a sentence except in accordance with the law,” State v. Shafer, 102 N.M. 629, 636, 698 P.2d 902, 909 (Ct.App.), cert. denied, 102 N.M. 613, 698 P.2d 886 (1985), the State argues that the agreement cannot be construed to limit the trial court’s ability to impose on Mares more than twenty-four-months incarceration.
*51This Court has long held that the trial court may impose only sentences which are authorized by law. See State v. Lucero, 48 N.M. 294, 298-99, 150 P.2d 119, 122 (1944). “[S]entences which are unauthorized by law are null and void.” Sneed v. Cox, 74 N.M. 659, 661, 397 P.2d 308, 309 (1964). In this case, however, the fact that the plea agreement may have required the trial court to suspend all but twenty-four or fewer months of incarceration does not require the imposition of an illegal sentence. A trial court has broad discretion to suspend or defer all or any part of a noncapital sentence. See NMSA 1978, § 31-20-3 (Repl. Pamp.1994). In addition, a trial court has broad discretion to accept or reject a plea agreement. State v. Hicks, 89 N.M. 568, 573, 555 P.2d 689, 694 (1976); see also SCRA 1986, 5-304(B) (Repl.Pamp.1992). It follows that a court has the discretion to accept a plea agreement that requires it to suspend or defer some or all of a sentence.
The State argues that if we allow the trial court to accept a plea limiting its ability to incarcerate an individual, then we preclude the court from enforcing conditions of probation. According to the State, such a rule would conflict with NMSA 1978, Sections 31-20-5 and 31-21-15 (Repl. Pamp.1994). Neither of those sections, however, requires the trial court to impose incarceration if the defendant violates the conditions of his probation. Further, the parties should be able to negotiate the terms of a plea agreement to the full extent allowed by law. If the prosecution wishes to offer a maximum potential incarceration provision in exchange for a guilty plea, it should be allowed to do so. The fact that such a plea may prevent the trial court from ordering that a defendant be incarcerated after a probation violation is something that the prosecution must weigh before it decides to offer the plea agreement. When all parties agree, however, that a plea agreement will include a maximum potential incarceration provision that governs both sentencing and post-sentencing procedures, and the trial court approves the agreement, this Court will enforce that provision and require the trial court to suspend the agreed-upon period of incarceration.
The trial court resolved the alleged ambiguity prior to its approval of the agreement. A plea agreement is a unique form of contract the terms of which must be interpreted, understood, and approved by the trial court. See SCRA 5-304. In reviewing and interpreting the agreement a court should construe the terms “according to what [petitioner] ‘reasonably understood’ when he entered his plea.” Lucero v. Kerby, 7 F.3d 1520, 1522 (10th Cir.1993) (quoting United States v. Hand, 913 F.2d 854, 856 (10th Cir.1990)). If the trial court resolves alleged ambiguities and no further objection is made, the agreement is no longer ambiguous on those points addressed by the court.
In this case the trial court resolved any ambiguity regarding the period of incarceration facing Mares in the event he violated the conditions of his probation. At the March 11 presentment hearing counsel for Mares specifically asked what would happen if Mares violated his probation conditions. The trial court expressly stated that the twenty-four-month cap applied to the initial sentencing proceedings only and applied only if Mares satisfied the conditions of his probation; if Mares violated probation, he faced nine-years incarceration. Mares’s counsel initially objected to this reading of the agreement, but he later gave his approval of the agreement. Thus, although the agreement may have contained an apparent ambiguity on its face, no genuine ambiguity existed after the parties acquiesced in the court’s interpretation. Further, Mares was informed at least twice that if he had violated probation, he could be sentenced to nine-years incarceration. When he was so informed at the March 29 hearing regarding his alleged probation violation, Mares did not object to the court’s statement that he faced potentially nine-years incarceration if the State proved he had used cocaine while on work release. Finally, neither Mares nor his attorney objected to the nine-year sentence imposed when the trial court entered its decision to revoke Mares’s probation. Specifically, Mares’s counsel did not argue that the plea agreement bound the trial court to a *52maximum sentence of twenty-four-months incarceration.
Before it approved the agreement, the trial court resolved the question regarding the period of incarceration facing Mares in the event he violated the conditions of his probation. Because of this resolution, and because neither Mares nor his counsel objected to the imposition of nine-years incarceration, we hold that the trial court correctly found the agreement not to be ambiguous. The trial court did no violence to the plea agreement by ordering Mares to serve nine-years incarceration.
Other issues. The Court of Appeals adopted the Lucero test as the standard for reviewing plea agreements, but the Court limited its inquiry to the terms of the agreement and construed all ambiguities strictly against the state. 118 N.M. at 221, 223, 880 P.2d at 318, 320. Judge Hartz, in dissent, argued that the Court should consider extrinsic evidence because such “would certainly seem relevant in determining what the defendant ‘reasonably understood.’” Id. at 225, 880 P.2d at 322 (Hartz, J., dissenting) (applying Mark V, Inc. v. Mellekas, 114 N.M. 778, 781, 845 P.2d 1232, 1235 (1993)). Judge Hartz also argued that plea agreements should not be construed strictly against the state “without knowing more about the manner in which the agreement was drafted.” Id., at 224, 880 P.2d at 321.
Because the trial court resolved all alleged ambiguities at issue here prior to its approval of the agreement, we do not reach the question whether the interpretation principles of Mark V, Inc. and its predecessor, C.R. Anthony Co. v. Loretto Mall Partners, 112 N.M. 504, 817 P.2d 238 (1991), should apply to plea agreements. We would be reluctant to apply such principles to plea agreements, however, because of the uniqueness of the trial court’s role in interpreting, understanding, and approving the terms of such agreements.
We also question whether ambiguities in a plea agreement should be construed strictly against the state in all cases. While the prosecution generally is responsible for drafting agreements, this Court will not bind the parties to a meaning of a term to which the parties did not agree merely because the state drafted the agreement. We agree with Judge Hartz that a plea agreement may be the product of negotiation between the prosecutor and the defense. Further, plea agreements are subject to the court’s approval, and the judge is free to inquire about the terms of the agreement before giving such approval. Thus a court should turn to rules of construction only after it has used all other methods of resolving the ambiguity, and plea agreements should be construed in favor of the non-drafting party only when an ambiguity cannot be resolved by a review of the relevant direct and extrinsic evidence.
Finally, we find no merit in Mares’s argument that he should have been treated the same as others who had committed similar offenses. The cases cited by Mares are sufficiently distinguishable and do not refute the proposition that the trial court had broad discretion in sentencing Mares. Even if the State was required to recommend that Mares be similarly treated under the terms of the plea agreement, the parties did not agree to any sentencing standard that would be recognized as a uniform standard in the community. In addition, Mares did not provide any evidence that the trial court went outside the uniform standard; rather, he merely provided evidence that the court did not duplicate the actions of the courts in a few other select cases.
Conclusion. The trial court would not have imposed on Mares more than twenty-four months in prison if he had satisfied the conditions of his probation. Mares was given a second chance to prove that he would abstain from possessing or trafficking illicit drugs. He accepted this opportunity and the dismissal of charges of a second count of trafficking cocaine as the benefit of his bargain. He then violated probation conditions, knowing that such violation could lead to more jail time. The extent of that jail time was not ambiguous when the court’s interpretation was made known to and expressly or tacitly accepted by Mares upon entry of judgment and sentence and again five days later when Mares appeared before the court concerning revocation of probation. The tri*53al court did no violence to the plea agreement by imposing nine-years incarceration following Mares’s violation of his probation conditions. Thus we reverse the Court of Appeals and affirm the trial court.
IT IS SO ORDERED.
BACA, C.J., and FRANCHINI, J., concur.