California’s governor late Sunday vetoed a bill that would have allowed police and sheriffs to free undocumented immigrants from custody once they became eligible for release even if there were requests by federal immigration authorities to hold them for possible deportation proceedings.

Immigration advocates say the federal requests, known as detainers or holds, cast a wide dragnet that has ensnared even those who had committed minor crimes or no offenses at all. But Immigration and Customs Enforcement had said the program was instrumental in helping enforce immigration laws and in getting violent offenders off the streets.