Sanctuary city status is not illegal.  It is based in the 10th amendment to the constitution.  It does not prevent federal immigration efforts, it simply declines to use city resources to assist as the city is not being funded to do so.  It is unconstitutional for the feds to force any state or local government to do a federal task for free.  Immigration has always been a federal, not local responsibility.