
869 So.2d 701 (2004)
Phillip ENNIS, Appellant,
v.
Jerry REGIER, Secretary, Department of Children and Family Services; and Gregory Venz, Supervisor, Sexually Violent Predator Unit, Appellees.
Nos. 2D03-877, 2D03-887.
District Court of Appeal of Florida, Second District.
April 2, 2004.
*702 Phillip Ennis, pro se.
Charles J. Crist, Jr., Attorney General, Tallahassee, and Janet A. McDonald, Assistant Attorney General, Tampa, for Appellees.
VILLANTI, Judge.
Phillip Ennis appeals from the dismissal of his two petitions for habeas corpus, contending that the trial court erred in dismissing the petitions and should have considered them on the merits. We affirm in part and reverse in part.
In summer 2000, Ennis was serving terms of imprisonment for sexual battery, attempted sexual battery, burglary, kidnaping, false imprisonment, and lewd and lascivious assault on a minor. He was due to be released on October 3, 2000; however, on October 2, 2000, the State filed a petition seeking to have Ennis civilly committed as a sexually violent predator pursuant to section 394.914, Florida Statutes (2000). Thus, rather than being released from prison, Ennis was transferred to the custody of the Department of Children and Family Services to be detained in accordance with the provisions of the Jimmy Ryce Act, sections 394.910-.930, Florida Statutes (2000).
While being detained, Ennis filed an emergency petition for writ of habeas corpus in which he contended that his continued detention was illegal because the expert's reports attached to the State's petition were inaccurate and legally insufficient and because the State had failed to comply with various time standards set forth in section 394.9135, Florida Statutes (2000). The trial court dismissed this petition based on Ennis's failure to exhaust administrative remedies and based on its conclusion that Ennis could not seek habeas relief under the Ryce Act on these grounds. Ennis appealed the dismissal of this petition in case number 2D03-877.
Ennis later filed a second emergency petition for writ of habeas corpus contending that his continued detention was unconstitutional as a violation of the Ex Post Facto clause and double jeopardy. The trial court dismissed this petition as well in an order identical to that entered on the previous petition. Ennis appealed the dismissal of this second petition in case number 2D03-887. This court consolidated the cases for purposes of this appeal.
In case number 2D03-887, we affirm the dismissal of the petition. We recognize that a writ of habeas corpus is the proper vehicle by which to challenge *703 the constitutionality of a statute under which the person is charged. See Murray v. Regier, 872 So.2d 217, 222-23, 2002 WL 31728885 (Fla. Dec. 5, 2002); Sandstrom v. Leader, 370 So.2d 3, 5 (Fla.1979). However, it is clear that Ennis is not entitled to relief on these grounds because his arguments have already been rejected by the United States Supreme Court and the Florida Supreme Court. Kansas v. Hendricks, 521 U.S. 346, 117 S.Ct. 2072, 138 L.Ed.2d 501 (1997); Westerheide v. State, 831 So.2d 93 (Fla.2002). Because there is clearly no merit to Ennis's petition, we affirm. See Murray, 872 So.2d at 223-24 (noting that although the Fourth District should have considered the defendant's habeas petition on the merits, the court would not remand because it was clear that the defendant was not entitled to relief based on Hendricks).
In case number 2D03-877, we affirm the dismissal of the petition in part and reverse in part. Ennis's contention that the expert's reports were not legally sufficient to support his detention is not a proper basis for habeas relief. Accordingly, we affirm the dismissal of the petition on that ground. However, Ennis's contention that the State did not comply with the time requirements of the Ryce Act does raise an issue that is properly the subject of a habeas petition. See Murray, 872 So.2d at 223 (noting that if the petitioner is contending that he was denied due process because the State did not comply with the statutory requirements, he may be entitled to habeas relief); Graham v. State, 826 So.2d 361 (Fla. 2d DCA 2002) (granting habeas relief because the respondent was being detained without a judicial finding of probable cause); Melvin v. State, 804 So.2d 460 (Fla. 2d DCA 2001) (granting habeas relief when the State had failed to provide sworn support for the commitment petition); Johnson v. Dep't of Children & Family Servs., 747 So.2d 402, 403 (Fla. 4th DCA 1999) (holding that habeas relief would be proper if the State failed to comply with the statutory requirement that all members of the multidisciplinary team sign the report supporting the commitment petition); Valdez v. Moore, 745 So.2d 1009 (Fla. 4th DCA 1999) (same). Therefore, the trial court should have considered this portion of Ennis's petition on the merits.
That being said, however, it is clear from the petition that Ennis is not entitled to complete relief. The State filed its petition seeking Ennis's civil commitment before his release from prison. The time requirements that Ennis alleges the State failed to meet apply only to those cases in which the petition is not filed before the respondent's release from custody. See § 394.9135, Fla. Stat. (2002). Because these provisions clearly do not apply to Ennis, he is not entitled to relief on this basis, and we affirm the dismissal on these grounds.
However, Ennis also asserts that he was not brought to trial within thirty days as required by section 394.916(1). The supreme court has held that while the thirty-day period is not jurisdictional, it is mandatory. State v. Goode, 830 So.2d 817 (Fla.2002). Thus, when a respondent is not brought to trial within that time frame, he is entitled to have the petition against him dismissed and is entitled to be released from confinement. Id.; Kinder v. State, 779 So.2d 512 (Fla. 2d DCA 2000). Thus, if in fact Ennis was not brought to trial within thirty days and if the State did not properly seek a continuance, Ennis could be entitled to immediate release. Therefore, on this issue alone, the trial court erred in dismissing Ennis's petition. Accordingly, we reverse and remand for *704 the trial court to consider this sole issue on the merits.
Affirmed in part; reversed in part.
WHATLEY and COVINGTON, JJ., concur.
