
898 So.2d 1193 (2005)
K.M., a child, Petitioner,
v.
DEPARTMENT OF JUVENILE JUSTICE, Respondent.
No. 1D05-1447.
District Court of Appeal of Florida, First District.
April 7, 2005.
Nancy Daniels, Public Defender, and John W. Hedrick, Assistant Public Defender, Tallahassee, for petitioner.
Charlie Crist, Attorney General, and Shasta W. Kruse, Assistant Attorney General, Tallahassee, for respondent.
PER CURIAM.
K.M., a juvenile, petitions this court for a writ of habeas corpus, alleging that she is being detained in secure detention in contravention of the statutory law of this state. We agree and grant the petition.
K.M. was arrested on a charge of petit theft and a Risk Assessment Instrument (RAI) scored seven points, authorizing nonsecure or home detention. She was released into home detention at that time. The following day, a detention hearing was held pursuant to section 985.215(2)(j), Florida Statutes, and the court heard testimony relating to K.M.'s problems in school and at home and her criminal history, and argument of counsel. She was ordered to be held in secure detention until the adjudicatory hearing.
According to petitioner, the court was bound by the RAI in determining the appropriate detention unless it complied with section 985.215(2)(j), which provides in pertinent part:
If the court orders a placement more restrictive than indicated by the results of the risk assessment instrument, the court shall state, in writing, clear and convincing reasons for such placement.
In response to the petition, the state correctly concedes that petitioner's argument is well-taken. J.J. v. Fryer, 765 So.2d 260 (Fla. 4th DCA 2000); C.L.C. v. State, 863 So.2d 397 (Fla. 4th DCA 2003); M.P. v. Gardner, 838 So.2d 711 (Fla. 4th DCA 2003); D.B. v. State, 848 So.2d 1219 (Fla. 3d DCA 2003).
We therefore conclude that the petition must be granted. A closer question, however, is the relief to which petitioner is entitled. The state argues that relief should be in the alternative, ordering the court to either comply with section 985.215(2)(j) or to order petitioner's release. Because neither counsel present at the detention hearing advised the trial judge of his obligation to enter a written order in this circumstance, and in the absence of statutory directive that failure to comply with section 985.215(2)(j) at the *1194 detention hearing cannot be cured at a later time, we agree with the state on the issue of remedy. See D.B., 848 So.2d at 1220 ("The [trial] court may revisit the issue if there is a basis to do so.")
To ensure that the duration of any improper detention is kept to a minimum, the trial court shall either enter a written order in accordance with section 985.215(2)(j), Florida Statutes, or order K.M.'s release from secure detention by 5 o'clock P.M. on the second business day that follows the date of this opinion.
PETITION GRANTED.
ALLEN, BARFIELD and THOMAS, JJ., concur.
