California lawmakers have taken steps to opt out of a controversial federal immigration enforcement program, joining a growing number of states that say it harms public safety and undermines local law enforcement.