
2 So.3d 388 (2009)
M.A.M., Petitioner,
v.
Vincent VURRO, as Superintendent of the Southwest Florida Juvenile Detention Center, Department of Juvenile Justice, Respondent.
No. 2D08-5147.
District Court of Appeal of Florida, Second District.
January 7, 2009.
*389 Kathleen A. Smith, Public Defender, and Heather Sutton-Lewis, Assistant Public Defender, Fort Myers, for Petitioner.
Bill McCollum, Attorney General, Tallahassee, and Katherine Coombs Cline, Assistant Attorney General, Tampa, for Respondent.
VILLANTI, Judge.
M.A.M., a juvenile, filed an emergency petition for writ of habeas corpus seeking to be discharged from secure detention. By prior unpublished order, we granted the petition and advised that this opinion would follow to explain our reasoning. We conclude that, under the relevant statutory provisions, M.A.M. could not legally be held in secure detention for more than a total of twenty-one days.
On October 8, 2008, M.A.M. was charged with misdemeanor battery on a family member. Upon arrest, M.A.M. was placed in secure detention by a juvenile probation officer ("JPO"). A "Juvenile Delinquency Minutes/Order" reflects that a detention hearing was held on October 9, and M.A.M. was ordered to be held in secure detention for two days beginning on October 9 and "pending next 48-hour review." Apparently, there was a second hearing on October 11, at which M.A.M. was ordered to remain in secure detention for another forty-eight hours; however, no copy of an order dated October 11 was included with M.A.M.'s petition. Then, at a third hearing on October 13, M.A.M. was ordered to be held in secure detention for twenty-one days beginning on October 13. This order indicates that an arraignment was scheduled for November 4, 2008.
In his emergency petition, M.A.M. alleged that he was being illegally held in secure detention because the relevant statutes limit secure detention to a total of twenty-one days, not two forty-eight-hour periods followed by twenty-one days. We agree.
Under the statutory provisions concerning juvenile detention, a child is taken into initial custody by a JPO. See § 985.25(1), Fla. Stat. (2008). The JPO determines the appropriate type of detention for the child, which can range from secure detention to home detention, based on factors outlined in a statutorily mandated risk assessment *390 instrument. See § 985.245, .25(1)(a), (b). The child must be given a detention hearing within twenty-four hours of being taken into custody. § 985.255(3)(a). When, as here, the child has been charged with committing an act of domestic violence that does not otherwise meet the secure detention criteria, the child may continue to be held in secure detention only if the court makes "specific written findings" that respite care is unavailable and that secure detention is required to prevent victim injury.[1] § 985.255(2). However,
[t]he child may not be held in secure detention under this subsection for more than 48 hours unless ordered by the court. After 48 hours, the court shall hold a hearing if the state attorney or victim requests that secure detention be continued. The child may continue to be held in detention care if the court makes a specific, written finding that detention care is necessary to protect the victim from injury. However, the child may not be held in detention care beyond the time limits set forth in this section or s. 985.26.

Id. (emphasis added). Section 985.26(2) provides that "[a] child may not be held in secure, nonsecure, or home detention care under a special detention order for more than 21 days unless an adjudicatory hearing for the case has been commenced in good faith by the court."
We conclude that sections 985.255(2) and 985.26(2) clearly prohibit the trial court from ordering that a child charged with domestic violence be held in secure detention for more than twenty-one days in total. See A.M.W. v. Portesy, 714 So.2d 1170, 1171 (Fla. 2d DCA 1998) ("[A] juvenile cannot be detained for longer than twenty-one days on the same offense."); T.O. v. Alachua Reg'l Juvenile Detention Ctr., 668 So.2d 243, 245 (Fla. 1st DCA) (holding that juvenile's detention was illegal when he had been held in secure detention for more than twenty-one days with no adjudicatory hearing and no motion to continue from the State), aff'd on other grounds, 684 So.2d 814 (Fla.1996). However, we also conclude that the twenty-one-day maximum does not include the initial twenty-four hours under which the child may be placed in custody at the JPO's discretion prior to the detention hearing. See § 985.26(2) ("A child may not be held in ... detention care under a special detention order for more than 21 days...." (emphasis added)); § 775.021(1), Fla. Stat. (2008) (holding that penal statutes "shall be strictly construed" and that any ambiguities "shall be construed most favorably to the accused"); see also A.M.P. v. State, 927 So.2d 97, 100 (Fla. 5th DCA 2006) (applying rule of lenity in section 775.021(1) in juvenile case); G.S. v. State, 761 So.2d 1229, 1230 (Fla. 3d DCA 2000) (applying strict construction provision of section 775.021(1) in juvenile case).
Here, the twenty-one-day clock on M.A.M.'s detention began running on October 9, the day on which M.A.M. was first brought into court for a detention hearing. Because no motion to continue was filed by the State and no adjudicatory hearing was commenced, M.A.M. was entitled to be released on day twenty-one, that is, October 29, the day we issued our order granting the emergency petition for writ of habeas *391 corpus.[2] Any detention after that date would have been illegal.
Petition granted.
STRINGER and DAVIS, JJ., Concur.
NOTES
[1]  In this case, the materials accompanying M.A.M.'s petition do not reflect that the court made written findings; however, M.A.M. does not argue the lack of written findings as a ground for habeas relief. We therefore comment on the apparent lack of written findings only to remind juvenile courts that such findings are required by the statute.
[2]  We note that the twenty-one days should be counted such that the first day of detention under a court order (here, October 9, 2008) is included in the count. This method of counting ensures that a child is not held in detention more than the imposed number of days. Cf. State v. R.F., 648 So.2d 293, 294 (Fla. 3d DCA 1995) (construing the term "day" in section 790.22(9)(a), Florida Statutes (Supp. 1994), as referring to a "24-hour period of time"). This is in contrast to another common method of counting days, in which the day of the action is not counted. See, e.g., Fla. R.Crim. P. 3.040 ("the day of the act or event from which the designated period of time begins to run is not to be included"). If this second method were to be used, the detention period could amount to more than twenty-one twenty-four-hour periods if, on the last day of detention, the child was held beyond the time of day at which detention was first imposed.
