; (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 ); or (iii) makes any similar determination that is legally authorized under State law. (B) An official from the State or county child welfare agency with expertise in child trauma and development determines that it is in the best interests of the child to be removed from the parent or legal guardian because the child is— (i) in danger of abuse or neglect at the hands of the parent or legal guardian; or (ii) a danger to himself or herself or to others. (C) The Chief Patrol Agent or the Area Port Director, in his or her official and undelegated capacity, authorizes separation, on the recommendation by an agent or officer of U.S. Customs and Border Protection, based on a finding that— (i) the child is a victim of trafficking or is at significant risk of becoming a victim of trafficking; (ii) there is a strong likelihood that the adult is not the parent or legal guardian of the child; or (iii) the child is in danger of abuse or neglect at the hands of the parent or legal guardian, or is a danger to himself or herself or to others. (2) Prohibition on separation A Federal agency may not remove a child from a parent or legal guardian solely for the policy goal of— (A) deterring individuals from migrating to the United States; or (B) promoting compliance with civil immigration law. (3) Documentation required The Secretary shall ensure that a separation based on a situation described in paragraph (1)(C)— (A) is documented in writing; and (B) includes— (i) the reason for such separation