delivered the Opinion of the Court.
¶1 David Wayne Kime (Kime) appeals from the judgment entered by the Eighteenth Judicial District Court, Gallatin County, on his convictions and sentences for felony theft, driving under the influence of alcohol (DUI) and driving while his license was suspended. We affirm.
¶2 The issue on appeal is whether the District Court abused its discretion in sentencing Kime by failing to give him sufficient credit for preconviction time served in jail.
BACKGROUND
¶3 On November 26, 2000, Kime was arrested and placed in the Gallatin County Detention Center (Jail) on charges of felony theft, DUI and driving while his license was suspended. On the following day, he appeared before the Gallatin County Justice Court, which set bail in the amount of $25,000. Kime did not post bail and remained incarcerated in the Jail.
¶4 At the time of his arrest, Kime was participating in a supervised release program as part of a prior sentence for a felony assault conviction. The prior sentence committed Kime to the custody of the Montana Department of Corrections (DOC) for a period of ten years, with five years suspended. On December 5, 2000, the DOC removed Kime from the supervised release program and he was transferred from the Jail to the Montana State Prison (MSP) to serve the remainder of his felony assault sentence.
¶5 On December 12, 2000, the State of Montana (State) charged Kime by information in the District Court with felony theft, second *343offense DUI and driving while his license was suspended. At Rime’s initial appearance, the District Court continued the $25,000 bail amount previously set by the Justice Court. Rime subsequently pleaded guilty to the charges pursuant to a plea agreement and, at sentencing, requested the court to credit his sentence with the time he was incarcerated between the dates of his arrest and the April 2,2001, sentencing. The District Court, however, credited Rime’s sentence only with 20 days time served between his arrest and December 5, 2000, when he was transported from the Jail to the MSP. The court entered judgment on the convictions and sentence and Rime appeals.
STANDARD OF REVIEW
¶6 We review a district court’s sentence for legality. State v. Horton, 2001 MT 100, ¶ 17, 305 Mont. 242, ¶ 17, 25 P.3d 886, ¶ 17 (citations omitted). Our standard of review of the legality of a sentence is whether the district court abused its discretion. Horton, ¶ 17.
DISCUSSION
¶7 Did the District Court abuse its discretion in sentencing Rime by failing to give him sufficient credit for preconviction time served in jail?
¶8 In refusing to credit Rime’s sentence with the time he was incarcerated subsequent to his transfer to the MSP on December 5, 2000, the District Court concluded that, after that point, Rime was incarcerated because of his prior felony offense rather than the offenses for which it was imposing sentence. Rime contends that the District Court abused its discretion.
¶9 Section 46-18-403(1), MCA, provides that “[a]ny person incarcerated on a bailable offense and against whom a judgment of imprisonment is rendered must be allowed credit for each day of incarceration prior to or after conviction....” Rime argues that, because all three of the offenses with which he was charged in this case are bailable offenses and the District Court imposed a sentence of imprisonment, § 46-18-403(1), MCA, requires that his sentence be credited with the entire time he was incarcerated between the date he was arrested and the date he was sentenced, notwithstanding the fact that he was also incarcerated at the MSP as a result of his prior felony conviction during a portion of that time. He relies on Horton in support of his argument.
¶10 In Horton, the defendant was arrested and charged with four offenses. Horton, ¶¶ 7-10. Shortly after his arrest, the State petitioned *344to revoke his suspended sentence imposed on an earlier offense. Horton, ¶ 9. Horton subsequently pleaded guilty to three of the offenses for which he had been arrested and the district court scheduled a sentencing hearing. Horton, ¶ 12. At sentencing, Horton requested the district court to credit his sentences with the time he served in jail from the time of his arrest through his sentencing. The court orally stated that Horton would be given credit for time served, but the later written sentence provided that he would not be given such credit because he also had been held in jail as a result of the revocation petition. Horton, ¶ 15.
¶11 On appeal, Horton argued that the district court had erred in issuing a written sentencing order which contradicted its oral sentence. The State conceded in response that, pursuant to § 46-18-403(1), MCA, Horton was entitled to credit for time served between his arrest and sentencing. Horton, ¶ 32. The State further conceded that, pursuant to State v. Lane, 1998 MT 76, 288 Mont. 286, 957 P.2d 9, a court’s oral pronouncement of sentence controls over a subsequent written sentence when there is a conflict between the two. Horton, ¶ 33. As a result, we held “that based upon § 46-18-403(1), MCA, and our holding in Lane, the sentence the District Court orally pronounced from the bench in Horton’s presence is the ‘legally effective sentence,”’ and struck from Horton’s sentence the provision that he would not be given credit for time served. Horton, ¶ 34.
¶12 Contrary to Kime’s argument that Horton requires that a defendant receive credit against a sentence of imprisonment for each day served prior to sentencing on a bailable offense, regardless of the fact that he or she also may have been incarcerated during the same period for some other reason, we conclude that our holding in Horton was based on the rule that an oral pronouncement of sentence controls over a subsequent contradictory written sentence. Because the State conceded without argument that Horton was statutorily entitled to credit for time served in jail, we were not presented with-and, thus, did not address-the issue of whether § 46-18-403(1), MCA, requires that a defendant’s sentence be credited with time served on an offense notwithstanding the fact that he or she was concurrently incarcerated as a result of proceedings relating to a different offense. We conclude, therefore, that Horton is of no assistance to Kime here. Moreover, Kime does not cite, nor have we found, any case in which we have addressed this issue.
¶13 Notwithstanding the absence of case authority, Kime contends that, as long as the two prerequisites of § 46-18-403(1), MCA, are *345met-that is, the defendant has been incarcerated on a bailable offense for which he or she receives a sentence of imprisonment-the plain language of the statute requires that the defendant’s sentence be credited for time served. The State responds that the statute provides for credit only for time a defendant is “incarcerated on a bailable offense” and that, once Kime was transported to the MSP on December 5, 2000, he was incarcerated on-and serving his sentence for-his nonbailable prior felony offense. Thus, according to the State, after December 5, 2000, Kime was no longer incarcerated on a bailable offense and is not entitled to credit for time served on the charges stemming from his arrest in November of 2000. In other words, the State argues that a defendant should only be credited for time served prior to sentencing where the incarceration is directly related to the offense for which the defendant subsequently is sentenced and that, after December 5, 2000, Kime’s incarceration was related to his sentence on the prior felony, not the offenses at issue in the present case. We agree.
¶14 Kime was transported to the MSP on December 5, 2000, to complete serving his sentence on the prior felony conviction. After that point, even if Kime had been able to post bail to secure his release on the charges in this case, he would not have been released from the MSP. Thus, each day he served in the MSP between that date and the date of his sentencing on the convictions at issue in this case was directly attributable to, and credited against, that prior conviction.
¶15 Moreover, the general purpose of § 46-18-403(1), MCA, is to eliminate the disparity of treatment between indigent and nonindigent defendants. In other words, credit for time served is given so as not to penalize indigent defendants who are unable to post bail and must remain in custody until they are sentenced when nonindigent defendants may secure their release and remain free during that time period. That purpose is not served by crediting a defendant’s sentence for time served where the defendant would not have been released from custody had he or she been able to post bail in any event as a result of being held on a sentence related to an earlier offense.
¶16 We conclude that, pursuant to § 46-18-403(1), MCA, a defendant’s sentence may be credited with the time he or she was incarcerated only if that incarceration was directly related to the offense for which the sentence is imposed. Here, the time Kime was incarcerated at the MSP between December 5, 2000, and the date of his sentencing was related to his prior felony conviction and not the charges of which he was convicted in the present case. As a result, we *346further conclude that the District Court correctly refused to credit Kime’s sentence with the time served between those dates. We hold, therefore, that the District Court did not abuse its discretion in sentencing Kime by failing to give him sufficient credit for preconviction time served in jail.
¶17 Affirmed.
JUSTICES REGNIER, TRIEWEILER, LEAPHART and RICE concur.