(b) Absent a court order, a juvenile may be taken into custody by a law-enforcement official only if one of the following conditions exists: (1) Grounds exist for the arrest of an adult in identical circumstances; (2) emergency conditions exist which, in the judgment of the officer, pose imminent danger to the health, safety and welfare of the juvenile; (3) the official has reasonable grounds to believe that the juvenile has left the care of his or her parents, guardian or custodian without the consent of such person and the health, safety and welfare of the juvenile is endangered; (4) the juvenile is a fugitive from a lawful custody or commitment order of a juvenile court; (5) the official has reasonable grounds to believe the juvenile to have been driving a motor vehicle with any amount of alcohol in his or her blood; or (6) the juvenile is the named respondent in an emergency protective order issued pursuant to section four hundred three, article twenty-seven, chapter forty-eight of this code and the individual filing the petition for the emergency protective order is the juvenile's parent, guardian or custodian or other person with whom the juvenile resides.
(c) Upon taking a juvenile into custody, with or without a court order, the official shall:
(1) Immediately notify the juvenile's parent, guardian, custodian or, if the parent, guardian or custodian cannot be located, a close relative;
(2) Release the juvenile into the custody of his or her parent, guardian or custodian unless:
(A) Circumstances present an immediate threat of serious bodily harm to the juvenile if released;
(B) No responsible adult can be found into whose custody the juvenile can be delivered: Provided, That each day the juvenile is detained, a written record must be made of all attempts to locate such a responsible adult; or
(C) The juvenile has been taken into custody for an alleged act of delinquency for which secure detention is permissible.
(3) If the juvenile is an alleged status offender or has been taken into custody pursuant to subdivision (6), subsection (b) of this section, immediately notify the Department of Health and Human Resources and, if the circumstances of either paragraph (A) or (B), subdivision (2) of this subsection exist and the requirements therein are met, the official may detain the juvenile, but only in a nonsecure or staff-secure facility;
(4) Take the juvenile without unnecessary delay before a juvenile referee or judge of the circuit court for a detention hearing pursuant to section eight-a of this article: Provided, That if no judge or juvenile referee is then available in the county, the official shall take the juvenile without unnecessary delay before any magistrate then available in the county for the sole purpose of conducting such a detention hearing. In no event may any delay in presenting the juvenile for a detention hearing exceed the next day after he or she is taken into custody.
(d) In the event that a juvenile is delivered into the custody of a sheriff or director of a detention facility, the sheriff or director shall immediately notify the court or juvenile referee. The sheriff or director shall immediately provide to every juvenile who is delivered into his or her custody a written statement explaining the juvenile's right to a prompt detention hearing, his or her right to counsel, including appointed counsel if he or she cannot afford counsel, and his or her privilege against self-incrimination. In all cases when a juvenile is delivered into a sheriff's or detention center director's custody, that official shall release the juvenile to his or her parent, guardian or custodian by the end of the next day unless the juvenile has been placed in detention after a hearing conducted pursuant to section eight-a of this article.
(e) The law-enforcement agency that takes a juvenile into custody or places a juvenile under arrest is responsible for the juvenile's initial transportation to a juvenile detention center or other Division of Juvenile Services' residential facility.
(f) Notwithstanding any other provision of this code, a juvenile detention center, or other Division of Juvenile Services' residential facility, is not required to accept a juvenile if the juvenile appears to be in need of medical attention of a degree necessitating treatment by a physician. If a juvenile is refused pursuant to the provisions of this subsection, the juvenile detention center, or other Division of Juvenile Services' residential facility, may not subsequently accept the juvenile for detention until the arresting or transporting officer provides the juvenile detention center, or other Division of Juvenile Services' residential facility, with a written clearance from a licensed physician reflecting that the juvenile has been examined and, if necessary, treated and which states that in the physician's medical opinion the juvenile can be safely confined in the juvenile detention center or other Division of Juvenile Services' residential facility.