
568 N.E.2d 946 (1991)
209 Ill. App.3d 987
154 Ill.Dec. 725
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Lucette TOWNSEND, Defendant-Appellant.
No. 3-90-0121.
Appellate Court of Illinois, Third District.
March 6, 1991.
*947 Mark D. Fisher, Office of the State Appellate Defender, Ottawa, Michael Brandt, Peoria, for Lucette Townsend.
Jay P. Hoffmann, State's Attys. Appellate Prosecutor, Ottawa, Kevin W. Lyons, State's Atty., Peoria, for the People.
Justice SLATER delivered the opinion of the court:
On December 20, 1989, the trial court found the defendant, Lucette Townsend, guilty of unlawful possession of a controlled substance (Ill.Rev.Stat.1989, ch. 56½, par. 1402(b)). Based on this possession conviction, the State filed a petition to revoke the defendant's probation in an unrelated retail theft conviction. On January 17, 1990, the police incarcerated the defendant based on the pending petition to revoke her probation. On February 2, 1990, the trial court sentenced her to 20 months' imprisonment for the possession conviction, giving her credit for 4 days she had spent in pre-trial custody. The court refused to give her credit for the 17 days she had spent in custody on the petition to revoke probation. The State subsequently dismissed the petition to revoke probation. The defendant appeals, arguing that the trial court erred in denying her credit for the time she spent in custody on the petition to revoke.
Section 5-8-7 of the Unified Code of Corrections provides in relevant part:
"(b) The offender shall be given credit on the determinate sentence or maximum term and the minimum period of imprisonment for time spent in custody as a result of the offense for which the sentence was imposed, at the rate specified in Section 3-6-3 of this Code.
(c) An offender arrested on one charge and prosecuted on another charge for conduct which occurred prior to his arrest shall be given credit on the determinate sentence or maximum term and the minimum term of imprisonment for time spent in custody under the former charge not credited against another sentence." Ill.Rev.Stat.1989, ch. 38, par. 1005-8-7(b), (c).
Neither the defendant nor the State cite any cases on point with the instant facts. The defendant contends that the basis for the petition to revoke was the possession conviction and she should therefore receive credit on her possession sentence for the time she spent in jail on the petition.
The State contends that the defendant was in jail due to the theft conviction. It argues that jail time served pursuant to a petition to revoke probation based on the commission of a later crime should be credited toward the sentence for the earlier crime, not that which is used as a basis for revocation. Relying on People v. Leggans (1986), 140 Ill.App.3d 268, 94 Ill.Dec. 615, 488 N.E.2d 614, and People v. Clem (1979), 72 Ill.App.3d 163, 28 Ill.Dec. 448, 390 N.E.2d 615.
We note that the object of section 5-8-7(b) is to account for all time served in confinement for a particular offense. (People *948 v. Scheib 76 Ill.2d 244, 28 Ill. Dec. 513, 390 N.E.2d 872.) Further, the general legislative intent is to prevent the State from depriving a defendant of credit for jail time through technical evasion. People v. Kane (1985), 136 Ill.App.3d 1030, 91 Ill.Dec. 737, 484 N.E.2d 296.
Based on the particular facts of this case and the legislative intent of section 5-8-7, we find that the defendant is entitled to credit for the time she spent in custody on the petition to revoke probation. The State is splitting hairs in arguing that the defendant was in jail for the theft conviction but not for the possession conviction. She was in jail because of both convictions. If anything, the possession conviction was the stronger factor. Had it not been for that conviction, she would have remained free on probation and bail pending sentencing.
Further, denying the defendant credit would defeat the general intent of section 5-8-7(c). The legislature added that section to prevent the State from dropping an initial charge and recharging a defendant with another crime, with the intent of denying credit for time spent in jail on the first charge. (People v. Kane (1985), 136 Ill. App.3d 1030, 91 Ill.Dec. 737, 484 N.E.2d 296.) In this case, the State is essentially trying to obtain the same impermissible result after trial rather than before. The State filed the petition to revoke, apparently intending to pursue it only if it was dissatisfied with the sentence on the possession conviction. When it found the sentence to its liking, it dismissed the petition. If the State were to get its way, the defendant would receive no credit for the time she served while the State waited to see whether her sentence was, in its view, sufficient.
Accordingly, we conclude that the defendant is entitled to 17 days' additional credit on her unlawful possession conviction. Pursuant to our authority under Supreme Court Rule 615(b) (107 Ill.2d R. 615(b)), we hereby order that 17 days be credited to the defendant's sentence.
The judgment of the circuit court of Peoria County is affirmed as modified.
Affirmed as modified.
STOUDER, P.J., and BARRY, J., concur.
