
306 S.E.2d 510 (1983)
In the Matter of Ralph Clapp ROGERS, Respondent.
No. 829DC1139.
Court of Appeals of North Carolina.
September 6, 1983.
*511 Atty. Gen. Rufus L. Edmisten by Asst. Atty. Gen. Wilson Hayman, for the State.
Special Counsel Stephen D. Kaylor, Butner, for respondent-appellant.
WEBB, Judge.
In 1981 the General Assembly revised G.S. 122-58.13 so that it now provides that the chief of medical services of a mental health facility shall discharge a committed respondent unconditionally at any time he determines the patient is no longer in need of hospitalization unless the patient was initially committed as the result of conduct resulting in his being charged with a violent crime for which he was found not guilty by reason of insanity or incapable of standing trial. For all persons in the latter categories, the chief of medical services must notify the Clerk of Superior Court in the county in which the facility is located 15 days before the respondent's discharge. The clerk must then schedule a rehearing to determine *512 the appropriateness of the respondent's release under the standards of commitment set forth in G.S. 122-58.8.
The respondent argues that this section of the statute violates the equal protection clauses of the Fourteenth Amendment to the United States Constitution and Article 1, Section 19 of the North Carolina Constitution. He contends there is no rational basis for putting him in a class of which the clerk has to be notified and a hearing conducted before he may be released from an institution when others similarly situated may be released at the time the chief of medical services determines they no longer need hospitalization. If a state, by statute, creates a class which is rationally related to a legitimate interest of the state, those placed in the class have not been deprived of the equal protection of the laws. See Hohn v. Slate, 48 N.C.App. 624, 269 S.E.2d 307 (1980). We believe the State has a legitimate interest in protecting persons from violent crimes. We also believe that requiring those for whom a magistrate or a grand jury has found probable cause that they have committed crimes of violence to be subject to a hearing before release from involuntary commitment is rationally related to the protection of persons from violent crimes.
The respondent argues that the amendment to the statute is not rationally related to the protection from those who pose a threat to the community. He says that he will be required under any circumstances to remain committed until the chief of medical services determines that he is no longer dangerous to himself or others. He further argues that to require a hearing after this has been determined for him but not for others confined for the same reasons does not bear a rational relationship to the protection of society. He points out that there are other protections, such as his reincarceration to await trial, which are adequate to protect society. The legislature does not have to be perfect in its classification. We believe there is a substantial difference between those who have been judicially charged with a crime of violence and those who have not so that the legislature can make the procedure more stringent for the release from a mental institution for this class of persons.
We do not believe Jackson v. Indiana, 406 U.S. 715, 92 S.Ct. 1845, 32 L.Ed.2d 435 (1972), relied on by respondent, governs. In that case a mentally retarded person was charged with robbery. He was committed by the trial court which found he "lacked comprehension sufficient to make his defense" until the Indiana Department of Mental Health should certify that "the defendant was sane." Since the evidence showed there was little likelihood the defendant's condition would improve, he had in effect been sentenced to confinement for life without being convicted of the crime. He argued in the United States Supreme Court that he did not receive equal protection of the laws by being confined in an Indiana mental institution without a similar hearing as those who were not charged with violating the law. The United States Supreme Court said:
"We hold that by subjecting Jackson to a commitment standard and to a more stringent standard of release than those generally applicable to all others not charged with offenses, and by thus condemning him in effect to permanent institutionalization without the showing required for commitment or the opportunity for release afforded by § 22-1209 and § 22-1907, Indiana deprived petitioner of equal protection of the laws under the Fourteenth Amendment."
Id. at 730, 92 S.Ct. at 1854, 32 L.Ed.2d at 446. This case differs from Jackson in that respondent is not confined indefinitely. He was committed under a procedure similar to those not charged with a crime and he may be released when he is found not dangerous to himself or others. We do not think requiring a hearing before his release deprives him of equal protection of the laws.
The respondent argues that the revision of G.S. 122-58.13 was not intended to have retroactive effect and we agree with him. It was not intended to apply to the past releases of patients from mental hospitals. *513 It is intended to apply to the procedure for the release of patients after its effective date and we believe it applies to any discharge of respondent after 1 July 1981.
The respondent also contends this is an ex post facto law and in violation of Article I, Section 10 of the United States Constitution, and Article I, Section 16 of the North Carolina Constitution. If the revision of G.S. 122-58.13 increases the punishment for a crime over the punishment which was applicable at the time the crime was committed, it is an ex post facto law. See Weaver v. Graham, 450 U.S. 24, 101 S.Ct. 960, 67 L.Ed.2d 17 (1981). We do not believe the procedures required by the revision of G.S. 122-58.13 comprise punishment for a crime. They are procedures which must be followed for the discharge of a patient from a mental institution and we believe the State may lawfully enforce them.
Affirmed.
WHICHARD and BRASWELL, JJ., concur.
