; and (B) the average length of care for unaccompanied alien children in custody of the Secretary of Health and Human Services exceeds 35 days. (6) Influx care facility The term influx care facility means an Office of Refugee Resettlement facility that is operated to provide temporary emergency shelter and services for unaccompanied alien children during an influx or emergency. (7) Office of Refugee Resettlement facility The term Office of Refugee Resettlement facility means any facility at which unaccompanied alien children are in the care and custody of the Secretary of Health and Human Services. (8) Standard care facility The term standard care facility means an Office of Refugee Resettlement facility— (A) that provides residential care for unaccompanied alien children; and (B) at which all programmatic components are administered onsite and in the least restrictive environment. (9) Unaccompanied alien child The term unaccompanied alien child has the meaning given the term in section 462(g) of the Homeland Security Act of 2002 ( 6 U.S.C. 279(g) ). 3. Ensuring that families remain together (a) Limitation on the separation of families (1) In general An agent or officer of U.S. Customs and Border Protection shall not remove a child from his or her parent or legal guardian at or near a port of entry or within 100 miles of the border of the United States unless one of the following situations has occurred: (A) A State court, authorized under State law— (i) terminates the rights of the parent or legal guardian; (ii) determines that it is in the best interests of the child to be removed from the parent or legal guardian, in accordance with the Adoption and Safe Families Act of 1997 ( Public Law 105–89 )