
683 N.W.2d 294 (2004)
STATE of Minnesota, Respondent,
v.
Francisco GARCIA, Appellant.
No. A03-483.
Supreme Court of Minnesota.
July 15, 2004.
*296 John M. Stuart, State Public Defender, Benjamin J. Butler, Assistant State Public Defender, Minneapolis, MN, for Appellant.
Mike Hatch, Attorney General, St. Paul, MN, Lisa N. Borgen, Clay County Attorney, Scott G. Collins, Assistant County Attorney, Moorhead, MN, for Respondent.
Heard, considered, and decided by the court en banc.

OPINION
PAGE, Justice.
The issue before this court is whether a juvenile convicted of first-degree aggravated robbery, and designated an extended jurisdiction juvenile (EJJ), is entitled to jail credit for time served at the Minnesota Correctional Facility at Red Wing (MCF-Red Wing). The sentencing court found that a juvenile designated as an EJJ was not entitled to jail credit. The court of appeals affirmed. For the reasons set forth below, we reverse and remand.
The relevant facts are simple and straightforward. On June 10, 1999, 14-year-old Francisco Garcia along with two other minors discussed robbing a pizza delivery person. They aborted their first robbery attempt because the delivery person was too physically fit. Garcia and one of the other minors then called a second pizza place and robbed that delivery person using a baseball bat and fireplace poker. The robbery netted Garcia and his friend approximately $100 in cash and checks, in addition to the pizza.
On June 14, 1999, a delinquency petition charging Garcia with one count of first-degree aggravated robbery, in violation of Minn.Stat. § 609.245, subd. 1 (2002), and one count of attempted simple robbery, in violation of Minn.Stat. §§ 609.17, subd. 1, and 609.24 (2002), was filed. After negotiating a plea calling for Garcia to plead guilty to aggravated robbery, designation of Garcia as an EJJ, and dismissal of the attempted simple robbery charge, Garcia was adjudicated an EJJ and sentenced as an adult to 58 months in prison on September 1, 1999.[1] Execution of the adult sentence was stayed and Garcia was placed on juvenile probation until his 21st birthday. As a condition of the juvenile disposition, Garcia was required to complete a residential treatment program at the Northwestern Minnesota Juvenile Center in Bemidji. At the sentencing hearing, the court noted that Garcia would be entitled to 83 days of credit against the adult sentence for time spent in custody between his arrest and sentencing if the adult sentence were ever executed.
Garcia was released from the juvenile center on August 14, 2000, and on September 12 Garcia was arrested on new felony charges and for violating the terms of his probation. On October 13, 2000, the court found Garcia in violation of his probation and ordered him to complete a residential juvenile corrections program at MCF-Red Wing. He completed that program in September 2001 and was released to a foster home. In March of 2002, Garcia absconded *297 from the foster home. He was arrested again on September 7 and charged with seven new felonies and violating his probation.
On March 5, 2003, a hearing was held to resolve the probation violation. Garcia admitted the probation violation, and the court vacated the stay of execution and imposed the 58-month adult sentence.[2] Garcia sought 407 days of jail credit for the time he spent at MCF-Red Wing, in addition to the credit for the 83 days that he had spent in jail awaiting initial disposition of the EJJ matter. The court granted Garcia jail credit for time served in the county jail after his September 7, 2002, arrest. The court declined to give Garcia credit for the time spent at MCF-Red Wing or the time spent awaiting disposition of the EJJ matter in 1999. Garcia appealed the denial of jail credit only for the time spent at MCF-Red Wing. The court of appeals affirmed, holding that Minn.Stat. § 260B.130, subd. 5 (2002), as amended in 2000, precluded the district court from granting Garcia credit for time served at MCF-Red Wing. State v. Garcia, 670 N.W.2d 297, 300 (Minn.App.2003).
In this appeal, Garcia makes four arguments challenging the denial of jail credit. The first is a two-part argument in which he contends that Minn.Stat. § 260B.130, subd. 5, is not applicable because MCF-Red Wing is not a juvenile facility and because subdivision 5 only applies to time spent in custody "prior to a summary hearing." He next argues that applying section 260B.130, subdivision 5, as amended, to the facts of his case results in a violation of the federal and Minnesota constitutional prohibitions against ex post facto laws. Garcia's third argument is that, as amended, subdivision 5 violates the separation of powers doctrine. Finally, Garcia argues that the denial of jail credit to EJJ offenders for time served in a juvenile facility violates the equal protection guarantees of the United States and Minnesota Constitutions.
Before considering Garcia's arguments, it is necessary to review the relevant law concerning jail credit. A defendant bears the burden of establishing that he/she is entitled to jail credit. State v. Willis, 376 N.W.2d 427, 428 n. 1 (Minn.1985). At the time of Garcia's offense in 1999, Minn.Stat. § 260B.130, subd. 5, which sets out the procedural requirements for executing an adult sentence after a probation violation by an EJJ, did not address the issue of credit for time previously served in a juvenile facility except to the extent that it provided that "the court shall treat the offender as an adult and order any of the adult sanctions authorized by section 609.14, subdivision 3."[3] Minnesota Rule of Criminal Procedure 27.03, subdivision 4(B), provides that when a court imposes a sentence "time spent in custody in connection with the offense or behavioral incident for which a sentence is imposed * * * shall be automatically deducted from the sentence and the term of imprisonment including time spent in custody as a condition of probation from a prior stay of imposition or execution of sentence." Minnesota Sentencing Guidelines III.C.3 provides that all *298 time served in custody "for the offense or behavioral incident for which the person is sentenced * * * shall be deducted * * * from the sentence imposed." Additionally, until it was amended in 2003, Minn. R. Juv. P. 18.06, subd. 1(d), provided for jail credit in cases involving juvenile certification to adult court. According to the comments to the juvenile delinquency rules, this provision was removed from the rules in 2003 because jail credit is awarded at the time of sentencing in adult court and is governed by the rules of criminal procedure. Minn. R. Juv. Delinq. P. 18, cmt. In sum, at the time of Garcia's conviction, the adult rules of criminal procedure governed jail credit for EJJs because section 260B.130, subdivision 5, provided that an EJJ whose probation was revoked be treated as an adult. In 2000, after Garcia was adjudicated an EJJ, but before he was ordered to serve time at MCF-Red Wing, Minn.Stat. § 260B.130, subd. 5, was amended to preclude EJJs from receiving jail credit "for time served in juvenile facility custody prior to a summary hearing." See also Act of March 7, 2000, ch. 255 § 1, 2000 Minn. Laws 25.
We consider Garcia's equal protection argument first because it is dispositive. The crux of the argument is that Minn.Stat. § 260B.130, subd. 5, as amended, violates the equal protection clauses of the federal and state constitutions because there is no rational basis for denying jail credit for time served in juvenile facilities to juveniles designated as EJJs while granting such credit to juveniles certified as adults.[4] The Equal Protection Clause of the Fourteenth Amendment provides, in relevant part, "No state shall * * * deny to any person within its jurisdiction equal protection of the laws." U.S. Const. amend. XIV, § 1. Article I, Section 2, of the Minnesota Constitution provides, "No member of this state shall be disenfranchised or deprived of any of the rights or privileges secured to any citizen thereof, unless by the law of the land or the judgment of his peers." "Both clauses have been analyzed under the same principles and begin with the mandate that all similarly situated individuals shall be treated alike, but only `invidious discrimination' is deemed constitutionally offensive." Scott v. Minneapolis Police Relief Ass'n, 615 N.W.2d 66, 74 (Minn.2000). This court reviews an equal protection challenge to a statute under a rational basis standard unless the challenge involves a suspect classification or a fundamental right. Id. Neither party contends that this case involves a suspect classification or a fundamental right.[5]
We have developed two formulations for the rational basis test. Kolton v. *299 County of Anoka, 645 N.W.2d 403, 411 (Minn.2002). The first formulation is the standard articulated by the federal courts. Under this formulation, "it must be determined whether the challenged classification has a legitimate purpose and whether it was reasonable to believe that use of the challenged classification would promote that purpose." Id. The second formulation, also known as the Minnesota rational basis test, requires that:
(1) The distinctions which separate those included within the classification from those excluded must not be manifestly arbitrary or fanciful but must be genuine and substantial, thereby providing a natural and reasonable basis to justify legislation adapted to peculiar conditions and needs; (2) the classification must be genuine or relevant to the purpose of the law; that is there must be an evident connection between the distinctive needs peculiar to the class and the prescribed remedy; and (3) the purpose of the statute must be one that the state can legitimately attempt to achieve.
State v. Russell, 477 N.W.2d 886, 888 (Minn.1991) (citations omitted). The key distinction between the federal and Minnesota tests is that under the Minnesota test "we have been unwilling to hypothesize a rational basis to justify a classification, as the more deferential federal standard requires. Instead, we have required a reasonable connection between the actual, and not just the theoretical, effect of the challenged classification and the statutory goals." Id. at 889. In this case, we will apply the Minnesota rational basis test.
We first must consider the state's argument that juveniles and adults are not similarly situated for equal protection purposes. The state's argument is flawed because on these facts the relevant comparison is not between adults and juveniles. The relevant comparison is between juveniles designated as EJJs who violate probation and have an adult sentence executed, and juveniles certified as adults who are initially placed on probation and then violate that probation and have their sentence executed. This case is distinguishable from State v. Mitchell, 577 N.W.2d 481, 493 (Minn.1998), in which we held that a 15-year-old charged with first-degree murder who was certified as an adult was not similarly situated to a 15-year-old who committed a murder and remained in the juvenile system. We held that they were not similarly situated because, when certifying a 15-year-old to adult court, a trial court considers numerous factors, including the offender's amenability to treatment, culpability, the seriousness of the offense, and other circumstances of the offense. Id. at 493. Here, when the stay of execution of an EJJ's adult sentence is revoked, Minn.Stat. § 260B.130, subd. 5, requires that the court treat the EJJ as an adult, thereby placing the EJJ in precisely the same position as the juvenile who was certified as an adult in the first instance. Therefore, EJJs who violate probation and subsequently have their adult sentence executed and certified juveniles who receive a probationary disposition, violate probation, and have their adult sentence executed, are similarly situated for purposes of equal protection.
We next consider whether, on the facts presented, there is a rational basis for denying jail credit to juveniles designated as EJJs while granting jail credit to juveniles certified as adults. See Russell, 477 N.W.2d at 888. The state contends that the denial of jail credit is rationally related to the legitimate government purpose of ensuring that EJJs do not reoffend. The state posits that giving jail credit to EJJs would erode the legitimate government purpose of ensuring that EJJs receive proper treatment. In other words, the *300 state argues that it is rational to hold the "stick" of a larger adult prison sentence over an EJJ's head but not a certified juvenile's head because EJJs are more amenable to treatment. Garcia argues that there is no rational basis for granting jail credit to "more dangerous" certified juveniles but not to "less dangerous" EJJs who have their adult prison sentences executed.
In order to determine whether there is a rational basis for denying jail credit to EJJs, it is helpful to understand the goals of the EJJ designation as articulated by the Minnesota Supreme Court Advisory Task Force on the Juvenile Justice System that recommended the creation of the EJJ scheme. The EJJ designation was conceived to provide "a more graduated juvenile justice system based on age and offense with a new transitional component between the juvenile and adult systems." Minn. Sup.Ct. Advisory Task Force on the Juv. Justice Sys., Final Report 32 (Jan.1994) (hereinafter Task Force Report); see also Kathryn A. Santelmann & Kari L. Lillesand, Extended Jurisdiction Juveniles in Minnesota: A Prosecutor's Perspective, 25 Wm. Mitchell L.Rev. 1303, 1311 (1999). The intent of the EJJ designation is to give juveniles "one last chance at success in the juvenile system, with the threat of adult sanctions as an incentive not to reoffend." Task Force Report at 33. An initial juvenile disposition reinforced by the possibility of adult sanctions gives juveniles "a certainty of punishment combined with an opportunity to be successful in the juvenile system." Id. at 34. Thus, unlike certified juveniles, EJJs are given one last chance at rehabilitation in the juvenile system before being subjected to adult sanctions.
The state's argument that the denial of jail credit is necessary to serve as a "stick" for EJJs in order to ensure compliance with the terms of the juvenile disposition, but it is not necessary for certified juveniles because they are not afforded one last chance in the juvenile system, does not withstand scrutiny. Not only did the advisory task force recognize that the threat of adult sanctions is necessary to ensure that EJJs do not reoffend, it also recommended that EJJs placed in secure juvenile facilities "receive credit for that time if there is ever a commitment to prison for a probation violation." Id. at 8. Thus, from the outset, it was not contemplated that denial of jail credit was a legitimate "incentive" to promote successful rehabilitation within the juvenile system.
Furthermore, the state's reasoning falls short because, when juveniles who are certified as adults are placed on probation as opposed to having their prison sentence executed, one would want them to have the same incentive to successfully complete their probationary programs as similarly situated EJJs. Put another way, it is not rational, under these circumstances, to punish juveniles designated as EJJs more severely than juveniles certified as adults who engage in the same conduct.[6] Disguising the more severe punishment as an "incentive" not to reoffend may be clever, but it does not make the classification reasonable.[7] The facts of this case poignantly *301 illustrate that point. It is difficult to envision how Garcia is not entitled to jail credit for the time he served at MCF-Red Wing for the aggravated robbery offense, but would be entitled to credit on the later second-degree assault conviction if he had been placed on probation.[8]
The distinctions that separate juveniles designated as EJJs from juveniles certified as adults with respect to entitlement to jail credit are manifestly arbitrary and fanciful and not genuine and substantial, and there is no evident connection between the distinctive needs peculiar to EJJs as compared to certified juveniles and the prescribed remedy. See Russell, 477 N.W.2d at 888. We therefore hold that section 260B.135, subdivision 5, fails to satisfy the Minnesota rational basis test because there is no "reasonable connection between the actual, and not just the theoretical, effect of the challenged classification and the statutory goals."[9]See id at 889.
Consequently, Garcia is entitled to receive jail credit for the time he served at MCF-Red Wing. Additionally, because Asfaha v. State, 665 N.W.2d 523, 528 (Minn.2003), was decided while this case was pending, Garcia is entitled to receive jail credit for the time he served at residential treatment facilities if the conditions that were imposed at those facilities were the functional equivalent of those at a jail or workhouse. We remand this case to the district court to determine the amount of jail credit Garcia is entitled to receive for time served at MCF-Red Wing and whether the conditions at the Northern Minnesota Juvenile Center were the functional equivalent of those at a jail or workhouse and, if so, the amount of jail credit he is entitled to receive for time served there.
Reversed and remanded.
NOTES
[1]  When sentencing an EJJ, a court must impose both a juvenile disposition and "an adult criminal sentence, the execution of which [is] stayed on the condition that the offender not violate the provisions of the disposition order and not commit a new offense." Minn.Stat. § 260B.130, subd. 4 (2002).
[2]  With regard to the felony charges, Garcia was certified as an adult and ultimately pleaded guilty to second-degree assault. The court sentenced Garcia to 21 months in prison consecutive to the 58-month sentence.
[3]  Section 260B.130, subdivision 5, also provides that, "Upon revocation, the offender's extended juvenile jurisdiction status is terminated and juvenile court jurisdiction is terminated. The ongoing jurisdiction for any adult sanction, other than commitment to the commissioner of corrections, is with the adult court."
[4]  In Asfaha v. State, 665 N.W.2d 523, 528 (Minn.2003), we held that a certified juvenile was entitled to jail credit for time served in a treatment facility when the "level of confinement and limitations imposed are the functional equivalent of those imposed at a jail, workhouse, or regional correctional facility." We also noted that the record supported the district court's finding that the restrictions imposed at the treatment facility were the "functional equivalent of those imposed at the juvenile correctional facility in Red Wing" and therefore credit should be granted. Id.
[5]  It is worth noting that the Montana Supreme Court utilized a strict scrutiny standard when it held that the state's Extended Jurisdiction Prosecution Act (EJPA) violated equal protection by not granting custody credit to EJPA juveniles whose probation was revoked and granting such credit to certified juveniles. In re S.L.M, 287 Mont. 23, 951 P.2d 1365, 1371-76 (1997). The Montana court employed a strict scrutiny standard because the statute affected physical liberty, which is a fundamental right under the Montana Constitution. Id. at 1371-72. The issue of whether the deprivation of liberty involves a fundamental right, not having been raised by the parties, need not be resolved in this case.
[6]  The facts of this case, when compared with Asfaha, cannot be distinguished in terms of one receiving jail credit and the other not. See 665 N.W.2d at 524. Asfaha was certified as an adult, placed on probation, and had his probation revoked and his sentence executed and was entitled to jail credit for time spent in a residential treatment facility, which we determined in essence was the functional equivalent of being placed at MCF-Red Wing. Id.
[7]  As Judge Crippen noted in a concurrence/dissent in the almost identical case of State v. Serena, 673 N.W.2d 182, 190 (Minn.App.2003), rev. granted (Minn. Feb. 17, 2004), "`[t]ough love' may be attractive in private contexts, but it does not represent an acceptable basis for public laws that impose greater punishment for less dangerous juveniles than for more dangerous juvenile offenders who * * * have been certified for adult-court prosecution." Id. He further stated that, "If there is rationality in big threats to less dangerous children, one is led to find rationality in laws providing punitive, severe consequences for failure to immediately discontinue a pattern of minor or even petty misconduct." Id.
[8]  Similarly, it is not difficult to imagine a scenario in which two juveniles commit a crime together. One of the juveniles has a more severe record and is more culpable for the crime and is certified as an adult, while the other juvenile is designated an EJJ. They both receive the same stayed adult sentence and serve time in custody as a condition of probation. Upon their release, they commit another crime together and have their probation revoked and the adult sentences executed. The less dangerous EJJ would not get credit for the time served in custody, but the more dangerous certified juvenile would receive credit and serve a shorter sentence for the identical crime and probation violation.
[9]  Because we base our decision on equal protection grounds, we need not reach Garcia's ex post facto argument. We vacate the holding of the court of appeals that the application of Minn.Stat. § 260B.130, subd. 5, as amended, to Garcia did not violate the United States and Minnesota Constitutions' prohibition on ex post facto laws. See Garcia, 670 N.W.2d at 300.
