
354 Mass. 666 (1968)
241 N.E.2d 822
COMMONWEALTH
vs.
WALTER L. MAJOR.
Supreme Judicial Court of Massachusetts, Hampden.
October 7, 1968.
November 5, 1968.
Present: WILKINS, C.J., SPALDING, WHITTEMORE, CUTTER, & REARDON, JJ.
Paul D. Hunter for the defendant.
Leonard E. Gibbons, Assistant District Attorney, for the Commonwealth.
*667 WHITTEMORE, J.
The defendant contends that the proceedings for his commitment under G.L.c. 123A, § 6, as a sexually dangerous person, while serving a sentence for an unrelated crime, were in violation of the Fourteenth Amendment to the Constitution of the United States in that he was denied equal protection of the laws. The defendant recognizes that in Peterson, petitioner, ante, 110, this issue was adjudicated adversely to his contention. We see no ground for overruling that decision.
The statute permits a trial and determination of whether a person is sexually dangerous only as to those who have been convicted of sex-related crimes (§§ 4 and 5) or who are in custody as prisoners or under sentence to the youth service board (§ 6). The defendant contends that for classification purposes the latter group is part of the general public and cannot reasonably be dealt with separately.
Prisoners are necessarily under recurrent and close observation by wardens, guards, and rehabilitation personnel. There is thus opportunity to discover sexually deviate behavior or tendencies. The likelihood that in the course of incarceration an afflicted prisoner will disclose such traits is substantial. The authority of § 6 to "the sheriff, keeper, master, superintendent or director of the youth service board" to bring about the preliminary examination by a psychiatrist[1] is given only in respect of a person in custody who "appears ... to be a sexually dangerous person and in need of ... care and treatment." Further steps depend upon an affirmative report following the preliminary examination. Hence there is reasonable assurance that the procedures will not be arbitrarily applied within the classification.
The classification does not depend upon the assumption that incarceration tends to create sexual deviation. It is beside the point that the only testimony on that issue in *668 this case was that there is no connection between imprisonment and being sexually dangerous.
The justification for removing sexually dangerous persons from society, restraining their liberty and freedom of action, and subjecting them to corrective treatment lies in assuring the safety of the general public as well as the safety and welfare of the dangerous person. As there is no certainty of cure, and the outcome in any particular case cannot be predicted, the specified confinement is for from one day to life, and confinement in all cases continues at least until there is sufficient improvement to warrant release on parole or there is a finding by the court that the subject is no longer a sexually dangerous person (§ 9). The statute, however, does not intend punishment and does not in terms impose it, and nothing therein justifies punitive treatment or confinement under any prison conditions, except such as are reasonably required for security.[2]Commonwealth v. Page, 339 Mass. 313. Indeed, implicit in the statute and its purpose is the obligation to provide an environment conducive to a cure or an alleviation of the dangerous trait. Nason v. Superintendent of Bridgewater State Hosp. 353 Mass. 604, 613.
As noted, the basis for the classification in § 6 of this nonpenal statute is, not the past misconduct of the persons in the group, but rather the observation which is necessarily incident to their punishment. It is not unreasonable for the Legislature to prescribe procedures leading to reasonable investigation of suspected persons within the group and to segregation and cure, if possible, of those found to be afflicted. Peterson, petitioner, supra, at 116-117. The classification made is reasonably relevant to its purpose. See Barbier v. Connolly, 113 U.S. 27, 32; Metropolitan Cas. Ins. Co. v. Brownell, 294 U.S. 580, 584; Goesaert v. Cleary, 335 U.S. 464, 467; Allied Stores of Ohio, Inc. v. Bowers, 358 U.S. 522, 527; McGowan v. Maryland, 366 U.S. 420, 426; *669 McQuade v. New York Cent. R.R. 320 Mass. 35, 38; Maher v. Brookline, 339 Mass. 209, 213; Hall-Omar Baking Co. v. Commissioner of Labor & Indus. 344 Mass. 695, 700. Compare Baxstrom v. Herold, 383 U.S. 107, 111 (distinguished in the Peterson case, supra); Vigeant v. Postal Tel. Cable Co. 260 Mass. 335, 337-341.
The Legislature is not required to extend c. 123A to members of the general public who have neither committed sex-related offences nor been subject to the intense custodial scrutiny given to prisoners. The Legislature may reasonably regard patients in State mental hospitals as adequately controlled by the restraints and safeguards provided with respect to the care and discharge of the mentally ill. See G.L.c. 123, §§ 2, 5, 68, 88A, 89 and 118A. Section 5, for example, allows the Department of Mental Health to discharge a person restrained because of mental illness only "if in its opinion he is not mentally ill or can be cared for after such discharge without danger to others and with benefit to himself." Persons temporarily in hospitals for ordinary illness or in military, fire, or police service are not subject to comparable observation.[3] Problems as to invasion of privacy and interference with individual liberty would be presented in any legislative attempt to establish procedures for observing, investigating, and acting against suspected persons who are not in custody and have not committed acts subjecting them to prosecution for sexual misconduct. That procedures for commitment of the mentally ill apply to all persons in the community notwithstanding somewhat similar underlying problems does not invalidate the classification created by c. 123A to deal with one category of illness.
Exceptions overruled.
NOTES
[1]  The similar authority given by § 6 to the District Attorney implies either that he has had the circumstances of a particular prisoner referred to him for evaluation by the custodial officer, or that he has learned of such circumstances from the official records of earlier observations by others who have had custody of the prisoner in connection with past offences.
[2]  The nonpenal intent of the statute is suggested by § 8 which permits any person "believing himself to be suffering from a physical or mental condition which may result in sexual trends dangerous to the welfare of the public" to apply and to be admitted to the treatment center.
[3]  The absence of limitation on the required discharge at the end of two years of persons in the restricted class of alcoholics and drug addicts confined under § 62 does not make unreasonable the classifications that have been made by other provisions of c. 123 and by c. 123A.
