
988 P.2d 39 (1999)
Jerry Herman SMITH, Appellant (Defendant),
v.
The STATE of Wyoming, Appellee (Plaintiff).
No. 99-36.
Supreme Court of Wyoming.
September 27, 1999.
Representing Appellant: Jerry Herman Smith, Pro Se.
Representing Appellee: Gay Woodhouse, Attorney General; Paul S. Rehurek, Deputy Attorney General; D. Michael Pauling, Senior Assistant Attorney General; and Kimberly A. Baker, Senior Assistant Attorney General.
Before LEHMAN, C.J., and THOMAS, MACY, GOLDEN and HILL, JJ.
MACY, Justice.
Appellant Jerry Smith appeals from the district court's order which granted him credit for part of the time he was incarcerated prior to his sentencing.
We affirm.

ISSUE
Smith, representing himself pro se, presents the following issue for our review:
Whether the District Court erred and abused its discretion when it denied in part, appellant's Motion to Grant full credit against his sentence for pre-sentence incarceration.

FACTS
On August 18, 1995, Smith was arrested on several counts involving forgery of a birth certificate. After remaining in custody at the Laramie County Detention Center for twenty days, he was released on bond on *40 September 7, 1995. His bond was revoked because he violated one of the conditions of his release, and he was arrested on October 21, 1995. Smith eventually pleaded guilty to one count of conspiracy to commit forgery in exchange for the dismissal of the other counts. On January 5, 1996, the district court sentenced Smith to serve a term of not less than three years nor more than four years in the Wyoming State Penitentiary; however, the court suspended the sentence and placed him on supervised probation.
Smith was taken into custody on October 28, 1997, pursuant to a petition to revoke his probation. On January 12, 1998, the district court revoked and reinstated his probation. The court ordered Smith to spend one year as a resident at Community Alternatives of Cheyenne. Smith remained at Community Alternatives until he escaped on June 16, 1998.
The state filed a petition to revoke Smith's probation on June 19, 1998, and the district court subsequently issued a warrant for his arrest. The state also filed charges against him for escape from official detention and felony larceny. Smith was taken into custody on July 6, 1998.
The district court held a hearing on August 14, 1998. Pursuant to a plea agreement with the state, Smith pleaded guilty to escape and misdemeanor larceny. He also admitted the allegations of the petition to revoke his probation. The district court revoked Smith's probation on the forgery conviction and reimposed the original three- to four-year sentence, crediting him with the 156 days that he spent at Community Alternatives. It also sentenced him to serve a term of not less than one year nor more than two years in the Wyoming State Penitentiary on the escape charge, which sentence was to run concurrently with his sentence on the forgery conviction. The district court sentenced Smith to serve a six-month sentence for his larceny conviction, but it suspended the sentence and placed him on probation.
Smith filed a motion for credit against his sentences for the time he served in the Laramie County Detention Center prior to his final sentencing. The district court granted him credit against his forgery sentence for the twenty days that he spent in custody between August 18, 1995, and September 7, 1995. Smith appealed to the Wyoming Supreme Court.

DISCUSSION
Smith asserts that the district court erred when it refused to grant him credit for all the time that he spent in the county jail prior to being sentenced. The state maintains that the district court's decision awarding him only twenty days of presentence confinement credit was correct. We agree with the state.
A sentence which does not include proper credit for presentence incarceration is illegal. Smith v. State, 932 P.2d 1281, 1282 (Wyo.1997). A criminal defendant is entitled to credit against his sentence for the time he was incarcerated prior to sentencing, provided that the confinement was due to his inability and failure to post bond on the offense for which he was awaiting disposition. Meek v. State, 956 P.2d 357, 358 (Wyo.1998); Renfro v. State, 785 P.2d 491, 498 (Wyo.1990). The purpose of this rule is to provide equal protection to defendants who are unable to post bond because of their indigence. Renfro, 785 P.2d at 497-98. A defendant is not, however, entitled to credit for the time that he spent in custody when his confinement would have continued despite his ability to post bond. Meek, 956 P.2d at 358; Renfro, 785 P.2d at 498. In accordance with this principle, a defendant is not entitled to credit against his sentence for the time he spent in custody while awaiting probation revocation proceedings because that confinement was not attributable to his financial inability to post bond. Milladge v. State, 900 P.2d 1156, 1160-61 (Wyo.1995).
Our review of the record reveals that Smith was incarcerated for five different periods of time. The district court credited two of those periods against his sentence: the twenty days that he spent in custody between August 18, 1995, and September 7, 1995; and the 156 days that he spent at Community Alternatives. The other three periods of confinement-October 21, 1995, through January 5, 1996; October 28, 1997, through January 12, 1998; and July 6, 1998, *41 through August 14, 1998-involved proceedings to revoke Smith's bond or his probation. Those periods of confinement would have persisted regardless of Smith's financial ability to post bond. He was not, therefore, entitled to credit against his sentences for those periods of incarceration.
Affirmed.
