Mayors against feds

Why exactly are mayors of cities telling illegal immigrants in their cities to resist the enforcement of federal law? And what are the states doing about it?