
169 Conn. 540 (1975)
WILLIAM LADEN
v.
WARDEN, CONNECTICUT CORRECTIONAL INSTITUTION, SOMERS
Supreme Court of Connecticut.
Argued May 14, 1975.
Decision released September 16, 1975.
HOUSE, C. J., LOISELLE, MACDONALD, LONGO and BARBER, JS.
Richard S. Cramer, for the appellant (plaintiff).
Stephen J. O'Neill, assistant attorney general, with whom, on the brief, was Carl R. Ajello, attorney general, for the appellee (defendant).
LONGO, J.
During the period from June 30, 1972, to November 2, 1972, the plaintiff was confined in the Community Correctional Center, New Haven, pursuant to writs of mittimus on charges which culminated in sentences of confinement. The writs of mittimus had issued because the plaintiff, an indigent, was unable to deposit bail. Because the plaintiff committed two separate infractions of jail regulations, the commissioner of correction ordered that a total of sixty days of presentence confinement credit, commonly referred to as "jail *541 time," be deducted from the prisoner's account. The plaintiff thereupon filed a petition for a writ of habeas corpus, claiming that he had been deprived of his rights guaranteed by the fourteenth amendment to the United States constitution. The court dismissed his petition for a writ of habeas corpus, and the plaintiff has appealed therefrom.
This court in Holmquist v. Manson, 168 Conn. 389, 362 A.2d 971, distinguished between "good time" and "jail time" under Connecticut statutes. General Statutes § 18-7 provides for "good time"; that is, where there has been good behavior, there may be a commutation of the total length of sentence that must be served. "Good time" credit may be earned during time served prior to sentencing or during time served after sentencing. On the other hand, General Statutes §§ 18-97 and 18-98 provide "jail time" credit only for time served by the detainee prior to sentencing.[1] "Jail time" statutes permit the commissioner to refuse credit for time served prior to sentencing if the detainee fails to conform to the rules of the institution. There exists no such authority by which the commissioner may refuse to credit a prisoner with time served after sentencing. As *542 noted in Holmquist, supra, the statutory scheme provides, in effect, that an indigent unable to raise bail, or any other person incarcerated, pursuant to a mittimus, is able to commence serving sentence prior to sentencing. See Mancinone v. Warden, 162 Conn. 430, 294 A.2d 564.

I
The plaintiff claims that the proviso in §§ 18-97 and 18-98 of the General Statutes that jail time may be credited toward sentence only if the prisoner conforms to the rules of the institution violates the equal protection clause of the fourteenth amendment to the United States constitution. Equal protection analysis must commence with a determination of whether a legislative classification is invidious, or "inherently suspect," or whether the legislation impinges upon a fundamental right. Where the legislation impinges upon a fundamental right or creates a suspect classification, then it must be struck down unless justified by a compelling state interest. Dunn v. Blumstein, 405 U.S. 330, 335, 342, 92 S. Ct. 995, 31 L. Ed.2d 274. Where *543 the statute does not involve fundamental rights or suspect classifications, the legislation will withstand constitutional attack if the distinction is founded on a rational basis. McGinnis v. Royster, 410 U.S. 263, 270, 93 S. Ct. 1055, 35 L. Ed.2d 282; Dandridge v. Williams, 397 U.S. 471, 484, 485, 90 S. Ct. 1153, 25 L. Ed.2d 491; F. S. Royster Guano Co. v. Virginia, 253 U.S. 412, 415, 40 S. Ct. 560, 64 L. Ed. 989; In re Application of Griffiths, 162 Conn. 249, 258, 294 A.2d 281, rev'd, 413 U.S. 717, 93 S. Ct. 2851, 37 L. Ed.2d 910; see Douglas v. California, 372 U.S. 353, 358, 83 S. Ct. 814, 9 L. Ed.2d 811.
The plaintiff claims that General Statutes §§ 18-97 and 18-98 discriminate against indigents by permitting the commissioner to refuse to credit a detainee with time served if the detainee fails to obey the rules of the institution, that indigency is a suspect classification, and that legislation based on that classification must be stricken unless it is based upon a compelling state interest.[2] The plaintiff had been sentenced to a term for certain *544 crimes. Had he been possessed of sufficient means, he would have commenced serving that sentence when confined upon termination of his bail after sentencing. Instead, the plaintiff, an indigent, by force of a court order was confined prior to sentencing. There is no question that his sentence could not be lengthened by the commissioner of correction after sentencing. However, by vesting the commissioner with authority to refuse to credit to a detainee time served prior to sentencing, the statutes operate to clothe the indigent with a vulnerability to longer confinement which his wealthier counterpart is not obliged to wear.[3]
The refusal to credit the plaintiff with jail time affects the period of his confinement and directly impinges on his fundamental right of liberty. In re Winship, 397 U.S. 358, 364, 90 S. Ct. 1068, 25 L. Ed.2d 368; Brenneman v. Madigan, 343 F. Sup. 128, 138 (N.D. Cal.). Hence his lengthened confinement must be justified by a compelling state interest. See Bolling v. Manson, 345 F. Sup. 48, 51 (D. Conn.). As the United States Supreme Court noted in McLaughlin v. Florida, 379 U.S. 184, 191, 85 S. Ct. 283, 13 L. Ed.2d 222, our inquiry must go further. "Judicial inquiry under the Equal Protection Clause ... does not end with a showing of *545 equal application among the members of the class defined by the legislation. The courts must reach and determine the question whether the classifications drawn in a statute are reasonable in light of its purpose." See Rinaldi v. Yeager, 384 U.S. 305, 309, 86 S. Ct. 1497, 16 L. Ed.2d 577.

II
The statutes under consideration do not meet the tests required by the equal protection clause enumerated above for several reasons. They are underinclusive; Vaccarella v. Fusari, 365 F. Sup. 1164, 1170 (D. Conn.); see note, "Developments in the LawEqual Protection," 82 Harv. L. Rev. 1065, 1082-87; in that they do not reach all prisoners who do not conform to the rules of the institution, but only detainees. Secondly, they create irrational classifications: e.g., persons who are convicted and who, on appeal, secure a remand are placed in a better position than those awaiting trial; infractors of the institution's rules who are eventually acquitted are not reached by the statutes; convicted prisoners who have been sentenced receive more favorable treatment than detainees.
A prisoner whose appeal is sustained and who is again convicted upon remand is no different from a prisoner awaiting initial trial and sentencing, because both are incarcerated awaiting sentencing and a proper disposition of their cases. It is constitutionally mandated that the "one time loser" receive credit for time served without permitting discretion by sentencing authorities. Pruett v. Texas, 468 F.2d 51, 55 (5th Cir.), aff'd en banc, 470 F.2d 1182 (5th Cir.), aff'd, 414 U.S. 802, 94 S. Ct. 118, 38 L. Ed.2d 39; Wilson v. North Carolina, 438 F.2d 284 (4th Cir.); Valdez v. State, 479 S.W.2d *546 927 (Tex. Crim. App.). The state's position that credit for time served is not constitutionally mandated in the case of detainees would require credit to a prisoner once convicted with time served, but permit the state to refuse to credit a person yet unconvicted. Ex parte Freeman, 486 S.W.2d 556 (Tex. Crim. App.); Valdez v. State, supra.
Further, detainees awaiting trial must be considered innocent. Confinement is not to be punitive in nature; its purpose is only to preserve order and discipline and to guarantee that detainees will be available for trial. Seale v. Manson, 326 F. Sup. 1375, 1379 (D. Conn.); Butler v. Crumlish, 229 F. Sup. 565, 567, 568 (E.D. Pa.), injunction denied on other grounds, 237 F. Sup. 58 (E.D. Pa.); see Jones v. Wittenberg, 323 F. Sup. 93, 100 (N.D. Ohio), aff'd sub nom. Jones v. Metzger, 456 F.2d 854 (6th Cir.). The framework set out in the statutes, however, results in greater protections for the convicted and sentenced prisoner in that his stay in prison may not be lengthened, but the presumably innocent detainee's stay may eventually be prolonged. See Rhem v. Malcolm, 371 F. Sup. 594, 623 (S.D. N.Y.), aff'd, 507 F.2d 333 (2d Cir.).
The statute also creates two classes of confined prisoners awaiting trial. It allows the commissioner to punish for infraction of prison regulations those who eventually are convicted but cannot reach those who are eventually acquitted, even if both are guilty of the identical infraction of prison regulations. In the first case, the prisoner's sentence may thereby be administratively extended, and for acts which may not constitute violations of the General Statutes. The prisoner who is acquitted, however, cannot be punished for offenses committed in prison, unless they were also in violation of the *547 General Statutes, and only after resort to judicial process, with the entire range of constitutional safeguards inherent thereto. "Yet it would be absurd to hold that a pre-trial detainee has less constitutional protection ... than one who has been convicted." Johnson v. Glick, 481 F.2d 1028, 1032 (2d Cir.), cert. denied, 414 U.S. 1033, 94 S. Ct. 462, 38 L. Ed.2d 324.

III
It is true that the maintenance of discipline in a prison constitutes a compelling state interest. However, the method chosen must be rationally connected to the end sought and must be within the constitutionally prescribed limitations with respect to the presentenced detainee. See Stapf v. United States, 367 F.2d 326, 329 (D.C. Cir.); Wolff v. McDonnell, 418 U.S. 539, 94 S. Ct. 2963, 41 L. Ed.2d 935. Presentenced detainees have all the constitutional rights of members of society except those incident to their custody for safekeeping prior to judgment. Collins v. Schoonfield, 344 F. Sup. 257 (D. Md.). There is no showing, in the light of the distant and tentative nature of the refusal to grant credit for time served, of the wide latitude of effective alternatives available to prison authorities which can be applied almost instantaneously to an infraction, and of the underinclusive classes of persons affected by the statute, that placing an additional burden on the detainee by the deprivation of credit for jail time served meets constitutional standards of being rational to the end to be attained. State v. Williams, 262 La. 769, 264 So.2d 638; see Tate v. Short, 401 U.S. 395, 91 S. Ct. 668, 28 L. Ed.2d 130; State v. DeWitt School, Inc., 151 Conn. 631, 634, 201 A.2d 472. "Although reasonable *548 classifications can be made when they are based on reasonable differences, ... in order for the legislature constitutionally to deal differently with different classes of persons, there must be `some natural and substantial difference germane to the subject and purposes of the legislation between those within the class included and those whom it leaves untouched.' Fountain Park Co. v. Hensler, 199 Ind. 95, 102, 155 N.E. 465; Lyman v. Adorno, 133 Conn. 511, 521, 52 A.2d 702; Francis v. Fitzpatrick, 129 Conn. 619, 623, 30 A.2d 552." Manufacturers Hanover Trust Co. v. Bartram, 158 Conn. 48, 62, 255 A.2d 828. "`[M] ere difference is not enough: the attempted classification "must always rest upon some difference which bears a reasonable and just relation to the act in respect to which the classification is proposed, and can never be made arbitrarily and without any such basis."` " Hartford Steam Boiler Inspection & Ins. Co. v. Harrison, 301 U.S. 459, 462, 57 S. Ct. 838, 81 L. Ed. 1223; see also Kellems v. Brown, 163 Conn. 478, 313 A.2d 53, appeal dismissed, 409 U.S. 1099, 93 S. Ct. 911, 34 L. Ed.2d 678; State v. Delgado, 161 Conn. 536, 290 A.2d 338. The interest in achieving order is at least as compelling in the case of the convict as for the detainee. The state has not shown, however, a compelling interest to cast a heavier burden of prolonged incarceration upon detainees than upon convicts in order to maintain discipline. Steele v. North Carolina, 348 F. Sup. 1023, 1025 (W.D. N.C.). "It is not sufficient for the State to show that durational residence requirements further a very substantial state interest. In pursuing that important interest, the State cannot choose means that unnecessarily burden or restrict constitutionally protected activity. Statutes affecting constitutional *549 rights must be drawn with `precision,' NAACP v. Button, 371 U.S. 415, 438 ... [83 S. Ct. 328, 9 L. Ed.2d 405]; United States v. Robel, 389 U.S. 258, 265 ... [88 S. Ct. 419, 19 L. Ed.2d 508], and must be `tailored' to serve their legitimate objectives. Shapiro v. Thompson, ... [394 U.S. 618, 631, 89 S. Ct. 1322, 22 L. Ed.2d 600]. And if there are other, reasonable ways to achieve those goals with a lesser burden on constitutionally protected activity, a State may not choose the way of greater interference. If it acts at all, it must choose `less drastic means.' Shelton v. Tucker, 364 U.S. 479, 488 ... [81 S. Ct. 247, 5 L. Ed.2d 231]." Dunn v. Blumstein, 405 U.S. 330, 343, 92 S. Ct. 995, 31 L. Ed.2d 274; see, e.g., In re Kapperman, 11 Cal.3d 542, 549, 522 P.2d 657. The method chosen by the statutes under attack is not sufficiently precise to be rationally connected to the end sought.
Therefore, that condition of §§ 18-97 and 18-98 that a person will receive credit for time served prior to sentencing only if he obeys the rules of the institution is not constitutionally valid, and the commissioner must credit such a person with all time served prior to sentencing. Ham v. North Carolina, 471 F.2d 406, 408 (4th Cir.); Taylor v. Gray, 375 F. Sup. 790, 792 (E.D. Wis.); Mohr v. Jordan, 370 F. Sup. 1149, 1152, 1154 (D. Md.); White v. Gilligan, 351 F. Sup. 1012, 1014 (S.D. Ohio); Workman v. Cardwell, 338 F. Sup. 893, 901 (N.D. Ohio); A.B.A., Standards Relating to Sentencing Alternatives and Procedures (Approved Draft, 1968) § 3.6; A.L.I., Model Penal Code (Proposed Official Draft, 1963) § 7.09; Schornhorst, "Presentence Confinement and the Constitution: The Burial of Dead Time," 23 Hastings *550 L.J. 1041; but see People v. Coy, 181 Colo. 393, 394, 509 P.2d 1239; Gamble v. Alabama, 509 F.2d 95 (5th Cir.); but compare with Cobb v. Bailey, 469 F.2d 1068 (5th Cir.). Of course, this decision does not affect the authority of the commissioner to credit good time to all prisoners alike.
There is error, the judgment is set aside and the case is remanded with direction to render judgment in accordance with this opinion.
In this opinion the other judges concurred.
NOTES
[1]  "[General Statutes] Sec. 18-97. CREDIT TOWARDS FINE OR SENTENCE FOR A PERIOD SPENT IN CUSTODY UNDER MITTIMUS. Any person receiving a fine or a sentence to a correctional institution or a community correctional center shall receive credit towards any portion of such fine as is not remitted or any portion of such sentence as to which execution is not suspended for any days spent in custody under a mittimus as a result of any court proceeding for the offense or acts for which such fine or sentence is imposed, provided he shall conform to the rules of the institution. Upon notification from the commissioner of correction, the clerk of the court shall enter such credit upon the order in the case of a fine, and upon the mittimus in the case of a sentence and it shall be the duty of the agency or person that held such person under such mittimus to inform the clerk of the court of the proper amount of such credit. In the case of a fine each credit day shall be computed at the rate of three dollars. In no event shall credit be allowed in excess of the fine or sentence actually imposed." (Emphasis added.)

"[General Statutes] Sec. 18-98. COMMUTATION OF SENTENCE FOR PERIOD DURING WHICH BAIL WAS DENIED OR UNAVAILABLE. Any person who has been denied bail or who has been unable to obtain bail and who is subsequently imprisoned is entitled to commutation of his sentence by the number of days which he spent in a community correctional center from the time he was denied or was unable to obtain bail to the time he was so imprisoned. The commissioner of correction shall, if such person has conformed to the rules of the institution, credit such person with the number of days to which the supervising officer of the correctional center where such person was confined while awaiting trial certifies such person was confined between the denial of bail to him or his inability to obtain bail and his imprisonment." (Emphasis added.)
[2]  Courts have struck down classifications based upon wealth as constitutionally invidious discrimination. Tate v. Short, 401 U.S. 395, 398, 91 S. Ct. 668, 28 L. Ed.2d 130; Griffin v. Illinois, 351 U.S. 12, 19, 76 S. Ct. 585, 100 L. Ed. 891. Upon this basis, courts have declared that credit must constitutionally be given for that time served prior to sentencing. King v. Wyrick, 516 F.2d 321 (8th Cir.); United States v. Gaines, 449 F.2d 143, 144 (2d Cir.); White v. Gilligan, 351 F. Sup. 1012, 1013 (S.D. Ohio), and cases cited. Some cases hold that there is no equal protection or due process problem involved with discretionary crediting of time served prior to sentencing because the sentencing judge is presumed to consider it in drawing up a sentence. See, e.g., Arrington v. McGruder, 490 F.2d 795 (D.C. Cir.); Myers v. United States, 446 F.2d,232, 235 (9th Cir.); compare with Monsour v. Gray, 375 F. Sup. 786, 788 (E.D. Wis.); Culp v. Bounds, 325 F. Sup. 416, 419 (W.D. N.C.). This is manifestly impossible where the commissioner, not the court, is vested with this discretion, because the commissioner can exercise it only after the court has pronounced sentence.
[3]  The statutes violate the due process clause of the fourteenth amendment to the United States constitution where they operate to lengthen the time a prisoner must serve in confinement beyond the maximum authorized by statute. Williams v. Illinois, 399 U.S. 235, 244, 90 S. Ct. 2018, 26 L. Ed.2d 586; North Carolina v. Pearce, 395 U.S. 711, 718, 89 S. Ct. 2072, 23 L. Ed.2d 656; United States ex rel. Pollack v. McGinnis, 337 F. Sup. 1220 (S.D. N.Y.), aff'd, 452 F.2d 833 (2d Cir.), cert. denied, 406 U.S. 905, 92 S. Ct. 1606, 31 L. Ed.2d 815; see Parker v. Estelle, 498 F.2d 625, 627 (5th Cir.). We need not explore the numerous due process problems associated with the statute, since the discussion on equal protection suffices to satisfy the plaintiff's claim.
