
170 P.3d 923 (2007)
2007 MT 218
339 Mont. 50
STATE of Montana, Plaintiff and Respondent,
v.
Michael MARSHALL, Defendant and Appellant.
No. DA 06-0187.
Supreme Court of Montana.
Submitted on Briefs January 31, 2007.
Decided September 5, 2007.
For Appellant: Jack H. Morris, Jardine & Morris, Whitehall, Montana.
For Respondent: Honorable Mike McGrath, Attorney General; Micheal S. Wellenstein, Assistant Attorney General, Helena, Montana, Mathew J. Johnson, County Attorney, Boulder, Montana.
Justice JIM RICE delivered the Opinion of the Court.
¶ 1 Michael Marshall (Marshall) appeals from the order of the Fifth Judicial District Court, Jefferson County, revoking his deferred sentence and committing Marshall to the Department of Corrections for eight years with four years suspended. The court ordered that Marshall would not be eligible *924 for parole until he successfully completes phases I and II of the sex offender treatment program, which he challenges on appeal. We affirm.
¶ 2 We consider the following issue on appeal:
¶ 3 Did the District Court err in imposing sex offender treatment as a condition of sentence because:
a. The treatment can only be imposed upon one who has either been designated as a sex offender or convicted of a sex crime?
b. The condition was not reasonably related to Marshall's burglary conviction?

BACKGROUND
¶ 4 On January 3, 2004, two months after turning seventeen, Marshall broke into a residence in Boulder, Montana. Cutting his hand in the process, Marshall bled on items throughout the house. He proceeded to break items in the house. Marshall then became aroused after going through a woman's underwear drawer, took some of the woman's underwear out of the drawer and masturbated on her bed. Marshall was arrested and charged as an adult with Burglary, a felony, in violation of § 45-6-204, MCA (2003); Attempted Theft, a misdemeanor, in violation of § 45-6-301(1)(a), MCA (2003); and Criminal Mischief, a misdemeanor, in violation of § 45-6-101(1)(a), MCA (2003). Marshall pled not guilty to the charges.
¶ 5 Marshall's counsel moved for and was granted a psychiatric evaluation of Marshall by Dr. Robert Page (Dr. Page), a clinical member of the Montana Sex Offender Treatment Association. On October 13, 2004, pursuant to a pre-trial agreement, Marshall entered a plea of guilty to burglary, and the State moved to dismiss the remaining two charged offenses. The District Court accepted the plea and granted the State's motion to dismiss the remaining offenses. The court imposed a six-year deferred sentence with a number of conditions, including that Marshall enroll in and successfully complete all treatment recommended by Dr. Page, including, but not limited to, chemical dependency and sexual offender treatment.
¶ 6 On February 1, 2005, the State filed a petition to revoke Marshall's deferred sentence, alleging that he had violated numerous conditions of his deferred sentence, including, at issue here, failure to complete sex offender treatment. Marshall had been terminated from treatment due to his failure to follow the treatment rules. Marshall appeared for a dispositional hearing on the State's petition to revoke on March 30, 2005. After receiving evidence and arguments from the parties, the District Court concluded that Marshall had violated the terms and conditions of his deferred sentence by failing to remain law abiding, failing to maintain employment, failing to complete treatment with Dr. Page and leaving his assigned district.
¶ 7 A sentencing hearing was held on August 10, 2005. Dr. Page testified regarding the evaluation of Marshall he had conducted approximately fifteen months earlier. During the hearing, the parties stipulated to continue the matter so Dr. Page could provide an updated evaluation. The court allowed Marshall to remain released on bond, but admonished Marshall that he must abide by the bond conditions, including a prohibition on the use of alcohol and the requirement that Marshall remain law abiding. Nonetheless, on September 22, 2005, Marshall was charged with several offenses arising out of the allegation that he had operated a motor vehicle while under the influence of alcohol, including criminal endangerment, minor in possession, and DUI. The State subsequently moved to revoke Marshall's bond and requested that the District Court issue a bench warrant for his arrest, which motion was granted.
¶ 8 On September 27, 2005, Dr. Page filed an updated evaluation. The District Court reconvened the sentencing hearing on October 19, 2005, and heard testimony from Dr. Page and Marshall's probation officer, Cathy Murphy, of Adult Probation and Parole. Both recommended a more structured sex offender treatment program for Marshall. Dr. Page testified that a prerelease program would provide the structured environment that Marshall needed to complete his sex *925 offender treatment, but further testified that if Marshall was not accepted into a prerelease program, then he should be sent to prison to complete phase I and II of the prison sex offender treatment program. Murphy testified that she did not believe there was any chance that Marshall would be accepted into a prerelease center, since she already had Marshall prescreened for placement in the Billings Prerelease Center  where she felt he had the best chance of getting in  and he had been denied admission. Consequently, Murphy recommended a ten-year prison sentence with five years suspended and that Marshall be designated as ineligible for parole until he completed phases I and II of the prison sex offender treatment program.
¶ 9 At the conclusion of the testimony and after the State made its recommendation of a prison sentence with sex offender treatment, Marshall's counsel argued that the court did not have the authority to order sex offender treatment because Marshall had been convicted of burglary, a non-sex offense. Marshall's counsel maintained that Marshall would be eligible for sex offender treatment only if he had been convicted of a sex crime and adjudicated a sex offender. The District Court disagreed, stating "that sex offender treatment is in play, it is a matter to be considered here," committed Marshall to the Department of Corrections for eight years with four years suspended, and ordered that Marshall would be ineligible for parole until he successfully completed phases I and II of sex offender treatment, as well as chemical dependency treatment, anger management treatment and mental health treatment. The court also designated Marshall a Level I sex offender. Marshall appeals.

STANDARD OF REVIEW
¶ 10 This Court reviews a criminal sentence for its legality; "that is, whether the sentence is within statutory parameters." State v. Webb, 2005 MT 5, ¶ 8, 325 Mont. 317, ¶ 8, 106 P.3d 521, ¶ 8 (citing State v. Heath, 2004 MT 58, ¶ 8, 320 Mont. 211, ¶ 8, 89 P.3d 947, ¶ 8).

DISCUSSION
¶ 11 Did the District Court err in imposing sex offender treatment as a condition of sentence because:
a. The treatment can only be imposed upon one who has either been designated as a sex offender or convicted of a sex crime?
¶ 12 First, we note that Marshall's arguments challenging the imposition of sex offender treatment are directed both to his "sentence and re-sentence." However, it is clear that he cannot now appeal his original sentence. The original deferred sentence was imposed on October 13, 2004, and Marshall had sixty days from that date, pursuant to M.R.App. P. 5(b), to appeal to this Court, but did not do so. Therefore, he is precluded from now challenging the legality of the conditions imposed therein. See State v. Muhammad, 2002 MT 47, ¶ 22, 309 Mont. 1, ¶ 22, 43 P.3d 318, ¶ 22. Having timely appealed from the sentence imposed upon revocation, Marshall may challenge the conditions of that sentence.
¶ 13 In the District Court's October 26, 2005, findings and judgment revoking deferred sentence and re-imposing sentence, the court designated Marshall as a Level I sex offender, following this colloquy at the sentencing hearing:
The Court: Do the parties wish the Court to make a designation?
Mr. Johnson: Your Honor, the State does not believe it's necessary, as long as Mr. Morris agrees with that.
Mr. Morris: I guess if the  Your Honor, as I recall from Dr. Page's report, he designated Mr. Marshall as having a low risk to re-offend; and based upon that, I think that's the only thing in the record that the Court could base a designation on. I would urge the Court, if the Court is going to adopt a designation, would be the lowest level, I think Level 1 risk to re-offend designation.
. . . .
The Court: So ordered.
¶ 14 Marshall contends the sex offender designation was not validly assigned because *926 a sex offender designation may only be made after a "strict procedure" is followed, citing § 46-18-111, MCA. He maintains the statute was not followed here and that the court made a designation based upon argument of the prosecution and not on any record evidence, and thus, Marshall will not be eligible for the prison's sex offender program and not be able to achieve eligibility for parole. Further, Marshall argues the condition is illegal because that program is limited to defendants convicted of sex crimes or validly designated a sex offender  neither of which Marshall contends occurred here.
¶ 15 The State responds that § 46-18-111, MCA, merely requires the presentence investigation to include a psychosexual evaluation and treatment recommendation when the defendant has committed certain named sex offenses, but offers no support for Marshall's claim that the defendant must receive a sex offender designation or be convicted of a sexual crime prior to undergoing sex offender treatment in prison. The State also maintains that, in any event, the sex offender designation was not based on the prosecutor's argument, as the prosecutor did not request the designation and instead told the court he did not believe it was necessary, but rather was based upon the evidence offered at the hearing and upon the request of Marshall's counsel.
¶ 16 Recently, in State v. Leitheiser, 2006 MT 70, 331 Mont. 464, 133 P.3d 185, we affirmed the imposition of sex offender treatment as a condition of Leitheiser's sentence for assault upon a minor. Leitheiser had argued that because he did not plead guilty to a sex offense, the court lacked authority to impose the condition. However, we concluded that the sentencing court had properly looked to "the facts underlying the plea to the charge to which Leitheiser pled guilty  that is, assault on a minor." Leitheiser, ¶ 24. Leitheiser's actions had involved sexual contact with the victim. We agreed with the District Court's statement that it "would be remiss if it sentenced [Leitheiser] and ignored the underlying factual situation." Leitheiser, ¶ 26.
¶ 17 The underlying factual situation here included sexual actions taken by Marshall during the burglary. Accordingly, the District Court was not precluded from imposing sex offender treatment as a condition of Marshall's sentence as a matter of law simply because Marshall had not been convicted of a sexual crime. Given this resolution, we need not further address the contention that Marshall was not validly designated a sex offender.
b. The condition was not reasonably related to his crime?
¶ 18 Marshall also insists that the sex offender treatment condition is not rationally related to the burglary to which he pled guilty, offering there is "no correlation between the conviction of burglary and the condition of sex offender treatment" and citing State v. Ommundson, 1999 MT 16, ¶ 11, 293 Mont. 133, ¶ 11, 974 P.2d 620, ¶ 11.
¶ 19 In Ommundson, a defendant convicted of DUI challenged the District Court's imposition of sex offender treatment as a condition of his sentence. We reversed the condition, holding that in order to be reasonably related to the objectives of rehabilitation and protection of the victim and society, a sentencing limitation or condition must have "some correlation or connection to the underlying offense for which the defendant is being sentenced." Ommundson, ¶ 11. Explaining that the objectives of the sentencing statute, now § 46-18-202(1)(f), MCA, were "(1) to rehabilitate the offender by imposing restitution or requiring treatment so that he or she does not repeat the same criminal conduct that gave rise to the sentence; and (2) to protect society from further similar conduct," we noted the absence of evidence that indecent exposure leads to increased occurrences of DUI or that treatment for indecent exposure will reduce the reoccurrence of alcohol abuse or lessen the incidence of DUI in society at large. Ommundson, ¶¶ 11, 12. We therefore concluded no nexus had been established between the requirement that the defendant participate in a sex offender program and the charged DUI offense. Ommundson, ¶ 12.
¶ 20 Section 46-18-202(1)(f), MCA, permits a sentencing court to impose any *927 sentencing limitation "reasonably related to the objectives of rehabilitation and the protection of the victim and society." The statutory terms "rehabilitation" and "protection of the victim and society" must be read in the context of the charged offense. Ommundson, ¶ 11; see also State v. Armstrong, 2006 MT 334, ¶ 11, 335 Mont. 131, ¶ 11, 151 P.3d 46, ¶ 11. "The objectives of § 46-18-202(1)(f), MCA, are to rehabilitate the offender by imposing restitution or requiring treatment so that he or she does not repeat the same criminal conduct and to protect society from further similar conduct. Thus, a limitation or condition in a sentence must have a correlation or connection to the underlying offense." Armstrong, ¶ 11 (citing Ommundson, ¶ 11). Stated differently, to be legal, a condition of sentence must have a nexus to the conviction. Armstrong, ¶ 11.
¶ 21 Here, the District Court found that the underlying facts of this burglary form a factual basis for the sex offender treatment requirement:
This is a burglary. This burglary is hinged upon conduct which has been ascertained to be and admitted to be sexual in nature, and sexually offensive in nature. The unrefuted evidence is that this Defendant should have sexual offender treatment, so the Court considers that as an item which is within the purview of those things which can be ordered as a condition of a sentence.
In his testimony, Dr. Page opined that "[Marshall] ha[d] admitted to committing a sexual offense." While burglarizing the house, Marshall went through a woman's underwear drawer, removed some of her underwear, aroused himself, and then masturbated on her bed. The parties did not dispute that these actions were in accordance with the evaluator's definition of a deviant sexual act. Dr. Page further noted that this behavior  which he described as "deviant sexual patterns of arousal masturbatory behavior with the use of female clothing, or particularly female underwear"  "involves suggestions of paraphilia, and potential for future deviant sexual actions, without therapy."
¶ 22 We conclude that there was a correlation or nexus between sex offender treatment and the circumstances of this crime, and that the condition was reasonable. Thus, the District Court did not err by imposing the treatment as a condition designed to rehabilitate Marshall and protect society from further offenses.
¶ 23 Affirmed.
We concur: KARLA M. GRAY, C.J., JOHN WARNER, PATRICIA COTTER, and W. WILLIAM LEAPHART, JJ.
