delivered the opinion of the court;
*381By leave of court the petitioner, Mack Smith, filed a petition for an original writ of habeas corpus challenging his detention by the respondent, Martin Jackson, sheriff of Will County. The facts are undisputed and only questions of law are involved.
It appears from the petition that in 1953 the petitioner was convicted of the crime of rape and sentenced to the penitentiary for a term of 20 years. By reason of credit for good time served the sentence expired on June 10, 1966, and the petitioner was scheduled to be released from the penitentiary on that date. On June 9, the State’s Attorney of Will County, where petitioner was confined, filed a petition alleging that the petitioner had been a sexually dangerous person for more than one year prior to that date and requesting a hearing to determine whether the petitioner was, in fact, a sexually dangerous person. The petitioner was brought before the circuit court of the 12th Judicial Circuit in Will County on June 10 and the court appointed an attorney to represent him. The court initially entered an order remanding the petitioner to the custody of the warden of the penitentiary but at the request of the petitioner and with the consent of the State’s Attorney of Will County he was not returned to the penitentiary but was remanded to the custody of the sheriff of Will County.
On June 20 counsel for the petitioner entered a special and limited appearance objecting to the jurisdiction of the court over the person of the petitioner. In support of the limited appearance counsel suggested that the court lacked jurisdiction because the proceeding was civil in nature and the petitioner had not been served with a summons. It was also urged that the court lacked jurisdiction because the proceedings had not been completed prior to the expiration of petitioner’s sentence. The final ground stated in support of the limited appearance was that the petition was filed by the State’s Attorney of Will County in the name of the People of the State of Illinois rather than being brought in *382the name of the Department of Public Safety of Illinois. The court overruled the limited appearance and granted the State’s Attorney leave to amend the petition to show that the proceeding was brought on behalf of the Department of Public Safety.
In this original proceeding in this court, petitioner has abandoned any claim with respect to the service of summons but again urges that he is illegally confined by the respondent because the proceeding was not brought by the proper party and because all proceedings were not completed prior to the expiration of his sentence. The petition filed in the trial court was filed under the provisions of section 8 of the State Penitentiary Act, (Ill. Rev. Stat. 1965, chap. 108, par. 112,) which, so far as it is relevant here, provides as follows :
“Before any convict who has been confined in the Illinois State Penitentiary for the crime of rape, * * ? is released upon the expiration of his sentence, the Department of Public Safety may file with the circuit court, of the county in which such convict is confined, a petition in writing setting forth facts tending to show that the convict is * * * a sexually dangerous person. In the case of a sexually dangerous person, such mental disorder shall have existed not less than one year prior to the date of filing such petition before the Department may file such petition.”
In our opinion the objection that the petition was not filed by the proper party is not well taken. The original petition bore the caption, “People of the State of Illinois v. Mack Smith, Jr.” When the objection was raised in the trial court the court asked the assistant State’s Attorney if he would state for the record that he had the authority of the Department of Public Safety to bring the petition and the prosecutor stated, “I make the statement unequivocally for the record.” In addition to this statement in open court the prosecutor filed an affidavit stating that the petition was brought by him at the request of and under the direction of *383the Department of Public Safety of the State of Illinois. The petition was then amended by leave of court to show that it was brought on the relation of the Department. It is clear from the record that the proceeding was commenced by the Department of Public Safety as provided in the above section and the fact that the petition was filed by the State’s Attorney of Will County and that it did not originally state that it was brought on the relation of the Department is of no significance.
The contention that the trial court lacked jurisdiction because the proceedings were not completed prior to the expiration of the petitioner’s sentence must be resolved by a construction of the statute. There is no express requirement in the statute as to when the proceedings must be completed, and the only requirement is that the petition be filed before a convict is released upon the expiration of his sentence. A prior act somewhat similar to the one in question here was considered by us in People ex rel. Elliott v. Juergens, 407 Ill. 391, in which we held the act valid. The precise question involved in the present case was not involved there for in that case there was no issue that the defendant was held beyond the expiration of his sentence. However, certain observations we made in that case are pertinent here. We pointed out that the purpose of the act was to protect the people from a person who has already served his time in the penitentiary but who was still a menace because he had become sexually dangerous. We also pointed out that the State has not only the power but the duty to protect citizens from persons who are sex criminals and who have not recovered from their criminal propensities while serving their sentences in the penitentiary, and noted that not only public safety but public morals were involved. We further drew an analogy between the act in question and the statutes pertaining to mentally ill persons and pointed out that such persons may be detained for a limited time where such restraint was necessary for their protection *384or the protection of other persons. It is clear that the intention of the" legislature was to provide a procedure which would prevent the release of sexually dangerous persons who have served their sentences in the penitentiary. To carry out this purpose the Department of Public Safety is authorized and directed to cause inquiry and examination to be made at suitable intervals to ascertain whether any convict has become sexually dangerous while in custody. Because the purpose of the act is to prevent the release of such a person it is of the greatest importance that an examination be made shortly before the expected release date since the condition of the convict upon that date is the relevant consideration and it obviously would be of no benefit to cause an examination to be made and a hearing to be held several months prior to the convict’s release. If an examination made shortly prior to the release date reveals that the convict might be sexually dangerous a judicial determination of that question is required. In the nature of things it may be expected that some reasonáble delay would ensue ■in the appointment of a commission to examine the petitioner, in the actual examination of him by the commission, and in the trial of the cause. Bearing in mind the intent of the statute to protect society from sexually dangerous persons, it is not unreasonable to assume that the legislature intended that the person not be released until his condition could be ascertained even though his original sentence has expired. The petition under section 8 and the petitioner’s detention were proper.
The petitioner argues, in the alternative, that the proceedings against him under section 8 were unreasonably extended beyond the expiration date of his sentence, in violation of the above section and the due process requirements of the Illinois and Federal constitutions.
We believe that the section cannot, consistent with due process of law, be construed as authorizing the indefinite detention of a prisoner beyond the expiration date of' his *385sentence for purposes of determining his fitness to rejoin society. The section contemplates that all proceedings brought under it be completed with dispatch, inasmuch as an individual is being detained in custody beyond the expiration of his sentence solely on the strength of facts “tending to show” that he is a sexually dangerous person, rather than conclusive evidence to that effect. Hence, while we have recognized that some delay in the proceedings under section 8 against an incarcerated individual would ensue from a proper administration of that section, and that, in all likelihood, even a diligent prosecution by the State would extend beyond the expiration of the person’s sentence, any delay involved therein must be reasonable.
The reasonableness of any delay in the above proceedings or, more specifically, the approximate length of time a convict may be detained after the expiration of his sentence, depends, of course, upon the particular facts and circumstances of the specific case. However, the factor most determinative of the reasonableness of any delay in these proceedings is whether the delay in question was caused by the inactivity of the State or by the affirmative actions of the accused in the form of motions or other dilatory proceedings. In the latter case, where the accused by his acts substantially contributes to the delay in the proceedings against him, such contribution militates against a finding that the resultant delay is not reasonable within statutory and constitutional dictates.
We find from the record and matters contained in the brief before us that the proceeding on the petition was not unreasonably extended in violation of the petitioner’s right of due process. The writ of habeas corpus is hereby quashed.
Writ quashed.