
934 P.2d 745 (1997)
Robert WHITE, Appellant (Defendant),
v.
The STATE of Wyoming, Appellee (Plaintiff).
No. 96-170.
Supreme Court of Wyoming.
March 19, 1997.
*746 Robert White, pro se.
William U. Hill, Attorney General, Paul S. Rehurek, Deputy Attorney General, D. Michael Pauling, Sr., Assistant Attorney General, Barbara L. Boyer, Sr., Assistant Attorney General, for Appellee.
Before TAYLOR, C.J., and THOMAS, MACY, GOLDEN and LEHMAN, JJ.
GOLDEN, Justice.
Robert White (White) appeals from the order of the District Court, Seventh Judicial District, denying his motion to correct an illegal sentence, based on his claim that he should have been credited for time spent as a non-resident in the Community Alternatives of Casper (CAC) program. We affirm the order of the district court.

ISSUES
Appellant White states his issue as follows:
Whether Appellant should be given credit for one hundred and fifty (150) days of time served to be credited against the minimum and maximum term of his sentence for time served at ("CAC") or Community Alternative Center pursuant to a lawful judgment and sentence.
In response, the State presents its statement of the issue as:
Did the district court properly deny Appellant's request for credit for time spent as a nonresident at Community Alternatives of Casper upon the revocation of his probation?

FACTS
On April 15, 1994, White received a suspended sentence of not less than two years nor more than four years in the Wyoming State Penitentiary. That sentence was suspended on the condition that White successfully complete two years of supervised probation under certain terms and conditions. One of the conditions of his probation was that he enter and successfully complete the program at Community Alternatives of Casper (CAC) as a non-resident at his expense.
On September 19, 1994, the State filed a petition for revocation of White's probation, stating that he tested positive for marijuana while attending the non-resident CAC program, in violation of the conditions of his probation. The district court subsequently revoked White's probation and ordered him to the state penitentiary to begin serving his sentence with credit for two days previously served.
On May 17, 1996, White filed a motion to correct an illegal sentence pursuant to Rule 35 of the Wyoming Rules of Criminal Procedure, asking for credit for all time served before his probation revocation. The district court denied that motion in its order dated May 29, 1996. This appeal timely followed.

STANDARD OF REVIEW
White claims the district court erred in denying his motion to correct an illegal sentence. "A motion to correct an illegal sentence is addressed to the sound discretion of the trial court but, if the sentence in fact is illegal, that discretion is limited." Ramirez v. State, 800 P.2d 503, 504 (Wyo.1990) (citing Renfro v. State, 785 P.2d 491 (Wyo.1990); Lightly v. State, 739 P.2d 1232 (Wyo.1987); Price v. State, 716 P.2d 324 (Wyo.1986)). An abuse of discretion is an "error of law committed by the court under the circumstances." Garcia v. State, 777 P.2d 603, 607 (Wyo.1989).

DISCUSSION
Rule 35(a) of the Wyoming Rules of Criminal Procedure provides:
The court may correct an illegal sentence at any time. Additionally the court may correct, reduce, or modify a sentence within the time and in the manner provided herein for the reduction of sentence.
In Ramirez, we reversed and remanded an illegal judgment and sentence which failed to give the defendant credit for his *747 presentence incarceration time against the minimum term of his sentence, holding:
We can discern no situation in which a trial court can refuse to correct a sentence that does not award credit for presentence incarceration time against the minimum term. The refusal to so correct the sentence must constitute an abuse of discretion.
Ramirez, 800 P.2d at 504. The Ramirez holding was predicated on an earlier case, Renfro v. State, 785 P.2d 491, 498 (Wyo. 1990), in which we held that credit will automatically be granted for presentence incarceration on all sentences.
However, Renfro and Ramirez are clearly distinguishable from this case. White was on probation and one of the conditions of his probation was participation in the non-resident CAC program. White was not incarcerated at CAC, nor was the time he spent at CAC time spent in custody, as contemplated by the discussion in Renfro. Renfro, 785 P.2d at 498-99 nn. 8 & 10. See also Prejean v. State, 794 P.2d 877, 878-79 (Wyo.1990) (individual is entitled to credit for time served as a residential inmate in a correctional facility; whether time in a facility counts as time served if probation is revoked depends upon whether a charge of escape from detention will lie). White's attendance at the CAC program was a condition of his probation, not time spent in official detention. WYO. STAT. § 6-5-201(a)(ii) (1988) (emphasis added) defines "official detention" as:
(ii) "Official detention" means arrest, detention in a facility for custody of persons under charge or conviction of crime or alleged or found to be delinquent, detention for extradition or deportation, or detention in any manner and in any place for law enforcement purposes. "Official detention" does not include supervision on probation or parole or constraint incidental to release on bail.
White does not argue that he was subject to an escape from official detention charge; rather, it is clear from the court's order that his attendance at the CAC program was a condition of his probation and he was not subject to official detention. See YellowBear v. State, 874 P.2d 241, 245-46 (Wyo.1994). Therefore, he is not entitled to presentence confinement credit for time served in a non-resident CAC program as a condition of his probation. The decision of the district court is affirmed.
