; and (B) is not subject to detention under subsection (d). (2) Contracts authorized The Director of U.S. Immigration and Customs Enforcement shall offer to enter into one or more contracts with one or more nonprofit service providers that, to the maximum extent practicable, have the capacity to provide evidence-based services required to operate an alternatives to detention program for the least restrictive setting. (3) Prioritization The Secretary of Homeland Security shall ensure that any expenditure for the Family Case Management Program is prioritized over any other expenditure from the Alternatives to Detention account. (4) Authorization of appropriations There are authorized to be appropriated such sums as may be necessary to carry out this subsection. (d) Immigration detention priorities (1) In general The Director of U.S. Immigration and Customs Enforcement shall prioritize the limited resources of U.S. Immigration and Customs Enforcement to detain aliens who pose— (A) a threat to national security or public safety; or (B) a risk of flight that cannot be mitigated by an alternative to detention. (2) Presumption Except in extraordinary circumstances, such as a circumstance in which an alien is known to be a member of a terrorist organization or a transnational criminal organization, an alien shall not be detained if— (A) the alien— (i) is known to suffer from a serious physical or mental illness; (ii) has a disability; (iii) is elderly; (iv) is pregnant or breastfeeding; (v) is under 18 years of age; or (vi) demonstrates that the alien is the primary caregiver of— (I) a person under 18 years of age; or (II) an infirm person