The opinion of the court was delivered by
SHEBELL, P.J.A.D.This is an appeal by the State of New Jersey from the January 16, 1996 resentencing, on remand from this court, of defendant, Carmen A. Mereadante, Jr. The appeal concerns only certain aspects of the Law Division judge’s grant of jail credits and his purported running of the sentence concurrent to a federal sentence that had already been fully served at the time of defendant’s original sentence on the present offense.
On February 16, 1993, defendant and his co-defendant were indicted for first degree possession of cocaine with intent to distribute (N.J.S.A. 2C:35-5a(l) and 2C:35-5b(l)) (count one), and with possession of cocaine (N.J.S.A. 2C:35-10a(l)) (count two). Their motion to suppress evidence was denied and they were tried before a jury. On February 18, 1994, both were found guilty of second degree possession with intent to distribute and third degree possession.
Pursuant to N.J.S.A. 2C:43-6f, the State moved for the imposition of an extended term upon defendant, but its motion was denied at sentencing on October 28, 1994. The two counts were *526merged, and defendant was sentenced to a five year custodial term with appropriate penalties and fees. The State moved for a stay of the court’s imposition of the five year sentence. This was denied by the sentencing judge. The State appealed the denial of its application for an extended term, and defendant cross-appealed the denial of his suppression motion.
The initial Judgment of Conviction set forth that defendant was to receive 184 days of jail credit for the period from April 26,1994, to November 4, 1994. The judge amended this judgment on December 2, 1994, to provide that defendant receive an additional 77 days of jail credit, for the period from February 9, 1994, to November 4, 1994, for a total credit of 261 days. On June 21, 1995, defendant was paroled by the State Parole Board.
On June 27, 1995, we affirmed defendant’s conviction, and held that the trial judge erred in denying the State’s motion for the imposition of an extended term. We noted that we “would affirm the most lenient extended prison term available under N.J.S.A. 2C:43-6f,” and remanded for resentencing. On October 23, 1995, the New Jersey Supreme Court denied defendant’s petition for certification.
On December 7,1995, defendant appeared for resentencing, but could not be sentenced as his presentence report was not adequate. On January 16, 1996, defendant was sentenced to a ten year term with a three year, four month period of parole eligibility, to run concurrently with defendant’s already expired federal sentence. The Judgment of Conviction provided:
the defendant is entitled to 527 days of jail credit for time served before the original sentence was imposed and 438 days of credit for time served between the date of sentence and this resentencing hearing.
The judge issued a written opinion concerning the credits he allowed. The following is from his opinion:
In 1991, the defendant, Carmen Mercadante, was convicted of distributing 20 grams of cocaine in the Federal District Court for the Middle District of Pennsylvania. He was sentenced to ten months in federal prison followed by a three year term of probation. On October 17, 1992, while serving his three year federal probationary term, the defendant was arrested for the State offense for which he is *527being resentenced today. That night, the defendant posted bail. He immediately turned himself in to federal authorities. Because his New Jersey arrest was a violation of his federal probation, the defendant was sentenced to 18 months in federal prison on October 26,1992.
The defendant was indicted for this offense on February 16, 1993. This indictment was soon forwarded to federal authorities. On March 1, 1993, the defendant officially invoked the AOD to expedite the disposition of his pending New Jersey case. On May 26,1993, the defendant had his first appearance in New Jersey. After revoking the defendant’s bail, the sitting judge informed the defendant, who had expressed his desire to dispose of the case as soon as possible, that trial should occur within 60 days. The defendant was also informed that he would “get jail credit if convictedf.] If it takes three months, you get three months jail credit.” Finally, the judge noted that because “we would like to expedite this” and that “maybe” the parties “could work out some plea”, like a sentence “concurrent to the sentence that he’s now serving.” On November 4, 1993, the defendant therefore waived his right to a 180 day disposition under the AOD because he undoubtedly believed that he would be awarded jail credit for the time he spent in the Bergen County Jail. Indeed, defense counsel states that, due to the defendant’s belief that he would receive jail credit, he informed the presiding judge on numerous occasions that the 180 day limitation of the AOD would not be invoked to dismiss the indictment.
Notwithstanding the bail judge’s express desire to expedite this ease, it languished in the system. Indeed, the defendant was not convicted until February 18, 1994 and remained in the Bergen County Jail until on November 4,1994, when he was sentenced by this court. Aside from the defendant’s waiver of the 180 day deadline, this case was delayed, in part, because the State, took a hard-line plea bargaining position. It offered not to seek an extended term if the defendant agreed to plead guilty to the first degree offense with which he was charged. The defendant refused, went to trial, and, on February 18, 1994, was convicted of the second degree crime of possession of \ ounce or more, but less than 5 ounces, of cocaine with the intent to distribute it. The State then moved for an extended term pursuant to N.J.S.A. 2C:44-6f, in effect seeking the sentence the defendant would have received had he agreed to the State’s terms in the first place. However, this court rejected the State’s application.
On February 9, 1994, while this case was still pending, the defendant’s federal sentence expired and the detainer lodged against him by federal authorities was lifted. On November 4, 1994, this court imposed a 5 year prison term. On December 2, 1994, the judgment of conviction was amended to reflect 261 days of jail credit, measured from February 9, 1994 (the date of the expiration of the defendant’s federal sentence) until November 4,1994 (the actual date of sentencing for the present New Jersey offense).
On June 21, 1995, the defendant was paroled from New Jersey State Prison. Next, by way of decision rendered on June 27, 1995, the Appellate Division reversed this court’s rejection of the State’s application for an extended term and remanded the matter to this court for “resentencing”.
[ (footnotes omitted).]
*528The judge analyzed defendant’s sentence in terms of eight discrete time periods and considered awarding the defendant jail credit for time spent in custody between October 21, 1992 (when defendant commenced his federal incarceration) and January 16, 1996 (when defendant was resentenced). A summary of the time periods and the trial court’s awarding of 965 days of jail credit, as principally set forth in the State’s brief, follows:
1. 10/21/92 (defendant incarcerated in federal system after his arrest in N.J.) to 5/26/93 (defendant makes appearance before the Honorable Bruce A. Gaeta, J.S.C. for cancellation of bench warrant). Defendant not awarded any days of jail credit for this period.
2. 5/26/93 (defendant’s appearance before Judge Gaeta) to 11/4/93 (defendant waives right to 180 day disposition under Interstate Agreement on Detainers (AOD), NJ.S.A. 2A:159-1 et seq.). Defendant awarded 162 days of jail credit for this period.
3. 11/4/93 (defendant waives right to 180 day disposition under the AOD) to 2/9/94 (defendant’s federal sentence expires). Defendant awarded 97 days of jail credit for this period.
4. 2/9/94 (defendant’s federal sentence expires) to [10/28/94] (defendant initially sentenced by Judge Parsons). Defendant awarded 261 days of jail credit for this period.
5. 11/4/94 (defendant initially sentenced) to 7/27/95 (Appellate Division remands the case for resentencing).1 Defendant awarded 265 days of jail credit for this period.
6. 7/27/95 (Appellate Division remands the case for resentencing) to 10/24/95 (New Jersey Supreme Court denies defendant’s petition for certification). Defendant awarded 89 days of jail credit for this period.
7. 10/24/95 (New Jersey Supreme Court denies defendant’s petition for certification) to 12/7/95 (resentencing hearing scheduled to be heard on this date). Defendant awarded 44 days of jail credit for this period.
8. 12/7/95 (resentencing hearing scheduled to be heard on this date) to 1/16/96 (date of resentencing). Defendant awarded 40 days of jail credit for this period.
Defendant asserts that the State’s appeal is violative of his due process rights and of his right to be protected against double jeopardy. Defendant’s position is dependent upon whether the sentence fixed by the judge was authorized by law. An illegal sentence is correctable at any time, even after the sentence has *529begun. State v. Eigenmann, 280 N.J.Super. 831, 337, 655 A.2d 452 (App.Div.1995) (“an illegal sentence can be corrected even if it means increasing the term of a custodial sentence that defendant has begun to serve”) (citing State v. Baker, 270 N.J.Super. 55, 74-77, 636 A.2d 553 (App.Div.), aff'd o.b., 138 N.J. 89, 648 A.2d 1127 (1994)); State v. Leslie, 269 N.J.Super. 78, 86, 634 A.2d 572 (App.Div.1993) (State had authority, if not the duty, to appeal an illegal sentence)); see R. 2:3-1. Conversely, the double jeopardy clause “prohibits the increase of the term imposed in a discretionary sentence.” State v. Kirk, 243 N.J.Super. 636, 642, 581 A.2d 115 (App.Div.1990); see also State v. Towey, 244 N.J.Super. 582, 597-600, 583 A.2d 352 (App.Div.1990). Thus, we must determine if the granting of certain jail credit was within the judge’s discretion or whether the grant created an illegal sentence. We may only act on those credits found to be clearly beyond the authority of the sentencing judge.
R. 3:21-8 governs credit for confinement pending sentence and states that a “defendant shall receive credit on the term of a custodial sentence for any time served in custody in jail or in a state hospital between arrest and the imposition of sentence.” The rule has repeatedly been interpreted to apply only to confinement directly attributable to the specific offense for which sentence is being imposed. State v. Garland, 226 N.J.Super. 356, 361, 544 A.2d 417 (App.Div.1988); In Re Hinsinger, 180 N.J.Super. 491, 499, 435 A.2d 850 (App.Div.1981); State v. Hill, 208 N.J.Super. 492, 495, 506 A.2d 373 (App.Div.1986); State v. Council, 137 N.J.Super. 306, 308, 349 A.2d 71 (App.Div.1975); State v. Marnin, 108 N.J.Super. 442, 444, 261 A.2d 682 (App.Div.1970), certif. den., 59 N.J. 435, 283 A.2d 534 (1971), cert. den., 400 U.S. 835, 91 S.Ct. 70, 27 L.Ed.2d 67 (1971).
In Hill, supra, defendant was a fugitive wanted in one county when a detainer was filed against him while he was incarcerated awaiting trial in another county on an unrelated matter. 208 N.J.Super. at 494, 506 A.2d 373. After being acquitted on the unrelated charge, the defendant sought jail credit against his new *530sentence for time spent in custody awaiting Ms acquittal. Ibid. We affirmed the trial court’s demal of credit based on the judge’s conclusion that the existence of a detainer against the defendant did not entitle him to credit for time spent waiting disposition of the unrelated matter. Id. at 494-95, 506 A.2d 373.
Similarly, in Council, supra, the defendant, while incarcerated in federal prison, was indicted in New Jersey and transferred to this State under a detainer. 137 N.J.Super. at 308, 349 A.2d 71. We demed jail credit for the period he was detained here because Ms New Jersey charges did not lengthen Ms stay in the federal institution. Id. at 309, 349 A.2d 71. We stated:
Here, defendant’s incarceration in the federal penitentiary was obviously for an unrelated offense. It has not been demonstrated that the detainer in any way lengthened his stay in that institution. We cannot speculate that the detainer might have had an adverse effect on defendant’s eligibility for parole.
[/6id]
In Mamin, supra, we also held that “due process does not mandate that time spent in custody must be credited against a sentence resulting from another conviction for an unrelated offense.” 108 N.J.Super. at 445, 261 A.2d 682. “[UJnlike money on deposit in the bank or a credit card, [time served] may not be drawn on or credited against penalties imposed for later criminal activities.” Ibid.
By contrast, in State v. Beatty, 128 N.J.Super. 488, 490, 320 A.2d 514 (App.Div.1974), the defendant, incarcerated in New York, was detained there for a period of nearly five months after his latest release date as a result of a New Jersey detainer. In those exceptional circumstances, we held that defendant must receive credit for the time he was detained after Ms New York release date because such confinement was due solely to the action taken by New Jersey. Id. at 491, 320 A.2d 514.
In Breeden v. New Jersey Dept. of Corrections, 132 N.J. 457, 460-62, 625 A.2d 1125 (1993), defendant escaped from New Jersey custody and committed a crime out-of-state for which he received *531a sentence that was ordered to run concurrently to his unexpired New Jersey sentence. Our Supreme Court held that the New Jersey sentencing court, upon a motion for reconsideration of sentence, could weigh the interests of comity, given the other jurisdiction’s intent that the punishment for both sentences be concurrent, against whether the penal aim of the New Jersey sentence would be fulfilled by awarding credit for time served in the other jurisdiction. Id. at 469-70, 625 A.2d 1125. The Court stated that the “sentencing court shall determine if the debt due to New Jersey is satisfied,” id. at 470, 625 A.2d 1125, and concluded with the following language:
Alternatively, the court may conclude, just as it could have decided to make the sentences concurrent had it originally imposed the sentence while the defendant was subject to an unexpired sentence elsewhere, that although separated in time in place, the offenses suggest a single period of aberrant behavior not warranting consecutive punishment.
{Id. at 471, 625 A.2d 1125.]
We are convinced that the sentencing judge went beyond his authority in granting credit to the defendant for time spent in the Bergen County Jail up to February 9,1994. This confinement was directly attributable to the defendant’s violation of his federal probation and not to his New Jersey offense. Defendant was required to serve his federal sentence even if he was not charged in this State. Defendant was released on bail on the same day he was arrested on the New Jersey charge. He then entered federal custody, and only after he failed to appear in our court, was a bench warrant issued. He next appeared in New Jersey to have the bench warrant cancelled and elected to remain lodged in the Bergen County jail until sentenced on the New Jersey offense. However, had he not chosen to do so, he would have been incarcerated in a federal penitentiary. The decision was his alone. Moreover, the assertion of the sentencing judge that defendant was denied federal good-time credits as a result of his New Jersey lodging appears to be erroneous. The situation here is clearly distinguishable from Beatty, supra, where it was this State’s detainer that caused defendant to be held in New York for an *532additional five months after his expected release. 128 N. J.Super. at 491, 320 A.2d 514.
We recognize that a sentencing court has discretion to run multiple sentences consecutive or concurrent. N.J.S.A 2C:44-5d. However, this grant of authority does not permit a sentencing judge to run a sentence concurrent to a prior expired sentence. While a New Jersey sentence can be run concurrent to a federal sentence, here there was no longer any federal sentence to run concurrent with because it had fully expired prior to defendant’s initial sentencing on the New Jersey charge. Further, there was no indication that the federal court intended that its sentence run concurrently with the New Jersey sentence. In any event, the judge’s finding that the two “offenses suggest a single period of aberrant behavior not warranting consecutive punishment” is well beyond any legitimate interpretation of the facts. Defendant’s federal drug conviction occurred four years before the New Jersey offense and in the interim there was a period of federal confinement and parole. There was no lawful basis to ran the sentences concurrent with each other.
We next turn to the judge’s decision that State v. Rosado, 131 N.J. 423, 621 A.2d 12 (1993), authorizes the award of credits against the parole ineligibility term for the period of time that the defendant was on parole prior to resentencing. In Rosado, the defendant was initially sentenced to a probationary term conditioned on 364 days in the county jail, from which the defendant was granted parole. Id. at 425, 621 A.2d 12. After violating his probation, defendant was resentenced to a five-year term of imprisonment with a three-year parole , disqualifier. Ibid. In affirming our decision that the resentencing judge should have credited time spent on parole against the county-jail term, the Supreme Court stated that the “problem centers on the provision in N.J.S.A 2C:45-l[e] that when a court resentences a defendant who has violated probation following service of a county-jail term imposed as a condition of probation, ‘the term of imprisonment served hereunder shall be credited toward service of such subse*533quent sentence.’ ” Id. at 428, 621 A.2d 12. The Court reasoned in part:
In addition to the case law relied on by the Appellate Division, we find substantial support elsewhere for the proposition that parole is the legal equivalent of imprisonment — a proposition that we adopt for purposes of computing credit for a “term of imprisonment” in the context of this case. Seventy years ago the United States Supreme Court declared:
The parole authorized by the statute does not suspend service or operate to shorten the term. While on parole the convict is bound to remain in the legal custody and under the control of the warden until the expiration of the term, less allowances, if any, for good conduct. While this is an amelioration of punishment, it is in legal effeett ] imprisonment. [Anderson v. Corall, 263 U.S. 193, 196, 44 S.CL 43, 44, 68 L.Ed. 247, 254 (1923).]
[Id. at 428, 621 A.2d 12.]
The court noted the lack of clarity in this area and stated that, without a statutory amendment by the Legislature, it would “construe against the State the ambiguity inherent in these penal enactments, and conclude that Rosado is entitled to credit for time served on parole.” Id. at 430, 621 A.2d 12 (citation omitted).
We are satisfied that Rosado requires defendant to receive credit for the time he spent on parole, even though N.J.S.A 2C:45-le is not implicated in this case. See also State v. Williams, 81 N.J. 498, 410 A.2d 251 (1980) (granting credit for defendant’s time spent on probation against a ten to fifteen year sentence with no parole ineligibility period). However, this does not compel the conclusion that time served on parole must be credited against a statutorily mandated parole ineligibility period of incarceration under N.J.SA 2C:43-6f. Rather, we hold the credit is to be applied against the aggregate term, and not against the Legislatively required parole ineligibility term of incarceration. It is the duty of the court to carry out the Legislature’s mandate regarding parole ineligibility terms of imprisonment.
N.J.SA 2C:43-6f provides in relevant part that
f. A person convicted of ... possessing with intent to distribute any dangerous substance or controlled dangerous substance analog under N.J.S. 2C:35-5 ... who has been previously convicted of manufacturing, distributing, dispensing or possessing with intent to distribute a controlled dangerous substance or controlled substance analog, shall upon application of the prosecuting attorney be sentenced by the court to an extended term as authorized by subsection c. of N.J.S. 2C:43-7, *534notwithstanding that extended terms are ordinarily discretionary with the court. The term of imprisonment shall, except as may be provided in NJ.S. 2C:35-12, include the imposition of a minimum term. The minimum term shall be fixed at, or between, one-third and one-half of the sentence imposed by the court or three years, whichever is greater ... during which the defendant shall be ineligible for parole.
This statute in our view militates against allowing parole to be considered as jail time. We fail to see how defendant can be heard to complain when he is given credit for time served on parole against time that he would otherwise have been required to spend on parole under the same sentence. We perceive a different result if, in fact, there was no ability to credit parole time against the base term because of the expiration of too great a portion of the aggregate term to permit full credit for the time served on parole.
In sum, defendant is entitled to credit against his sentence, including the parole ineligibility term, for the. time he was actually confined in prison from the date of the expiration of his federal sentence on February 9, 1994, up to his parole on the present charge on June 21, 1995. Defendant is also entitled to credit against his aggregate sentence, but not against the parole ineligibility term, for the period he was on parole from June 21, 1995, to his resentencing and incarceration on January 16, 1996. Defendant is not entitled to any other credits except for the time he has continued to serve since he was resentenced.
We reverse and remand for calculation of the credits and amendment of the Judgment of Conviction.
We issued our remand on June 27, 1995. The trial court's written opinion used July 27, 1995, in breaking down this section of defendant's jail time.