
932 P.2d 1281 (1997)
Travis SMITH, Appellant (Defendant),
v.
The STATE of Wyoming, Appellee (Plaintiff).
No. 95-290.
Supreme Court of Wyoming.
February 6, 1997.
Sylvia Lee Hackl, State Public Defender, PDP; Deborah Cornia, Assistant Public Defender, representing Appellant.
William U. Hill, Attorney General; Paul Rehurek, Deputy Attorney General; D. Michael Pauling, Senior Assistant Attorney General; Georgia L. Tibbetts, Assistant Attorney General, representing Appellee.
Before, TAYLOR C.J., and THOMAS, MACY, GOLDEN and LEHMAN, JJ.
THOMAS, Justice.
The only question presented in this appeal is whether Travis Smith (Smith) should have received a presentence confinement credit against his sentence for escape from official detention in violation of WYO.STAT. § 6-5-206(a)(i) (1988) and WYO.STAT. § 7-18-112 (1988). The record is clear that once he was returned to custody, Smith was credited with presentence confinement time against the sentence he was serving at the time of his escape. The district court declined to afford him double credit for confinement in the county jail, and we hold that the trial court ruled correctly. The judgment and sentence must be affirmed.
In his Brief of the Appellant, Smith states the issue as:
Did the trial court err when it denied the Appellant credit for time served?
The State, in the Brief of the Appellee, offers this statement of the issue:
Did the district court err in denying Appellant credit on his escape sentence for time served in county jail?
In 1987, Smith was convicted of aggravated assault, for which he served a sentence of not less than twelve nor more than fourteen months in the penitentiary. In 1993, he was convicted of being a felon in possession of a firearm. That conviction resulted in a sentence of two to three years in the penitentiary. While serving that sentence at the Community Alternatives Program in Casper, Smith did not return to the facility on February *1282 25, 1995. On April 21, 1995, he was charged with escape from official detention, and he was arrested on the charge on April 29, 1995. Smith remained in custody until he entered a plea of guilty on June 29, 1996. He was released on bond, but the bond was revoked because of a hold placed against him by the penitentiary. He was returned to jail on July 6, 1995, and on October 17, 1995 Smith was sentenced to two to three years for escape. The State concedes that his escape sentence is to run concurrently with the sentence for being a felon in possession of a firearm.
Smith's claim is that he was denied credit against his sentence on the escape violation for 174 days of presentence confinement. He relies upon the period between his arrest on April 29, 1995 until he was able to post bond on June 29, 1995, and the period from July 6, 1995 until he was sentenced on October 17, 1995. The State contends that the trial court concluded the time should be applied to the sentence for being a felon in possession of a firearm because of the hold placed on Smith by the penitentiary.
Our rule that a sentence which falls within the minimum and maximum terms set by the legislature will not be reversed in the absence of a clear abuse of discretion is well established. E.g., Garcia v. State, 908 P.2d 413, 414 (Wyo.1995); Young v. State, 904 P.2d 359, 362 (Wyo.1995); Wilson v. State, 896 P.2d 1327, 1328 (Wyo.1995); YellowBear v. State, 874 P.2d 241, 244 (Wyo.1994); Betzle v. State, 847 P.2d 1010, 1024 (Wyo.1993); Carey v. State, 715 P.2d 244, 249 (Wyo.1986), cert. denied, 479 U.S. 882, 107 S.Ct. 270, 93 L.Ed.2d 247 (1986). There is no question that the sentence imposed on Smith is within the minimum and maximum terms set by the statute proscribing escape from detention. WYO. STAT. § 6-5-206(a)(1) (1988). Equally well established is our rule that a defendant must be afforded credit against both the minimum and maximum sentence for time spent in presentence confinement. Milladge v. State, 900 P.2d 1156, 1160 (Wyo.1995); Eustice v. State 871 P.2d 682 (Wyo.1994); Prejean v. State, 794 P.2d 877 (Wyo.1990); Renfro v. State, 785 P.2d 491 (Wyo.1990).
If credit for presentence incarceration is not given the result may be an illegal sentence. Eustice v. State, 871 P.2d 682, 684 (Wyo.1994). As we said in Renfro v. State, 785 P.2d 491, 498 n. 8 (Wyo.1990) (alteration in original), (citing Lightly v. State, 739 P.2d 1232 (Wyo.1987)):
Presentence confinement incarceration is defined as incarceration for inability and failure to post bond on the offense for which the sentence is entered and does not include revoked probation or other confinement that would continue to exist without regard for bond posting capabilities in this particular proceeding.

In recent cases, we have made clear the proposition that credit for presentence confinement does not include any credit for confinement that would persist without regard to the defendant's ability to post bond in the court in which he is awaiting sentence. Wayt v. State, 912 P.2d 1106 (Wyo.1996); Wilson v. State, 896 P.2d 1327 (Wyo.1995). In Wilson, it was clear that Wilson would have remained in custody on another charge even if he had posted bond on the charge for which he sought presentence confinement credit. In Wayt, Wayt was held in Platte County on different charges than the one for which he was awaiting sentence in Natrona County. Under the circumstances, no credit was required.
Smith's case may serve as a classic example of a situation in which the presentence confinement is not attributable to his inability to post bond. Smith actually did succeed in posting bond on the escape charge, only to have that bond revoked because of the hold placed against him by the state penitentiary based upon the sentence for being a felon in possession of a firearm. The confinement in the Natrona County jail was attributable to the hold, and the time spent in confinement had to be counted toward service of his existing sentence.
The district court denied Smith credit for his presentence confinement on his escape sentence, because Smith was being held for the State Penitentiary on the sentence he was serving. The district court correctly ruled that Smith was entitled to credit for time served in the county jail towards the *1283 underlying conviction of being a felon in possession of a firearm. Smith complains that the district court should have specified the time that was to be credited on the existing sentence, but that is a function of the executive department of government. If Smith is entitled to release in the future because of an incorrect computation of the time served on his sentence, he has a remedy available to him at that time.
The Judgment and Sentence of the Court is affirmed.
