Sanctuary cities/states are locations where the government and policeforce are "uncooperative" with the federal government. If they arrest someone who is an illegal immigrant, they will not notify ICE that they have done so. I believe they will also not release such a person into the care of ICE without direct orders to do so. They will not prevent ICE from detaining people, but will not offer assistance. Since the job of detaining illegals belongs to the federal government, state and local police cannot be ordered to assist.