Earlier this year, Sacramento County Sheriff Scott Jones invited Immigrations and Custom Enforcement chief Thomas Homan to a community forum. The event was advertised to the public as an opportunity to clear up misinformation around the immigration debate.

In private, however, Jones confided over email to Homan and other ICE officials that he wanted to use the event help to derail Senate Bill 54, legislation proposed to create so-called “sanctuary state” protections in California.

In a follow-up email confirming the forum, Jones wrote to Timothy Robbins, the Los Angeles enforcement director for ICE: “I can’t thank you and the director enough for agreeing to do this. I’m sure there are more comfortable ways to spend a Tuesday evening, but I do believe this will turn the tide of SB54.”

President Donald Trump’s assault on so-called sanctuary cities — municipalities that, to varying degrees, refuse to cooperate with federal immigration authorities — has included threats to cut off federal funding streams. Among these grant programs are several that give financial support to local law enforcement agencies. While it’s not clear what effect cutting these programs would have on public safety, they have become a flashpoint in the debate over local and, in the case of California, statewide efforts to create sanctuaries for immigrants who are in the country without legal authorization.

The Trump administration has a relatively small political foothold in California; Democrats control all statewide elected offices and hold a supermajority in the state legislature. Yet the California State Sheriffs’ Association has spearheaded the effort to defeat SB 54.

All but one of California’s elected county sheriffs have mounted a robust lobbying effort, deploying considerable advocacy resources along with a media campaign closely coordinated with the Trump administration. The sheriffs’ bare-knuckle advocacy efforts are detailed in emails obtained by The Intercept through California Public Records Act requests.

The current head of the CSSA, William Brown, who also serves as the sheriff of Santa Barbara County, has taken a lead role in public as the voice of opposition to SB 54.

In an attempt to assuage concerns, legislators added amendments to the bill that allowed law enforcement agencies to refer those immigrants who are in the country illegally and also convicted of serious and violent felonies to immigration officials. But Brown was unmoved: He declared during an Assembly hearing earlier this year that, despite the amendments, the legislation still “provides sanctuary for criminals.”

Behind the scenes, Brown has moved aggressively to court opposition to SB 54.

Emails show that should the bill pass, law enforcement may ally with far-right forces to place a ballot initiative to roll back the protections. In February, Brown corresponded about such an initiative with Ted Hilton, an anti-immigration activist who has claimed in the past that giving unauthorized immigrants a legal path to citizenship would make the U.S. like a “Third World country.” Draft language of the ballot initiative would give ICE wide latitude in processing any undocumented individual arrested by local police.

“This is the best political climate to move forward on this type of measure with advocacy from the Trump administration,” Hilton said. His email was forwarded to Brown by an assistant, who confirmed over email that the two would hold an in-person meeting. Hilton also claimed that he had secured assurance from Rep. Darrell Issa, R-Calif., that the campaign to push a ballot initiative forward could make use of the congressman’s voter lists.

In addition to corresponding with anti-immigration activists, Brown coordinated closely with ICE to make the case against SB 54. In April, Brown expressed frustration in an email to an ICE official, noting that the agency could have done more to assist with his campaign against sanctuary policies. He noted that he had previously requested information on the “primary charges of previous inmates who were released to ICE in 2016.”

The California sheriffs lobbying against SB 54 have centered their campaign on claims that the bill will force the release of violent criminals. That information, Brown wrote to an ICE official, could have been “very valuable, and I suspect would have reflected very beneficially on ICE, in my numerous recent meetings with legislators, advocacy groups, and the media re: SB 54 and immigration issues generally.”

Along with other sheriffs, Brown raised the issue of the loss of federal funding, a threat that the Trump administration has made to any jurisdiction with sanctuary policies. In a letter to Assemblymember Monique Limón, whom political observers see as a swing Democrat on a variety of contentious issues, he stressed the danger of losing “vital federal funding” with passage of the bill.

Sacramento lobbying firm Warner, Pank, Salzillo & Sanchez, which helped the sheriffs mobilize for news conferences and approaching legislators, also maintains a close watch on the tactics of their opposition.

A note from John Robertson, the Napa County sheriff, alerted fellow sheriffs that the American Civil Liberties Union could be setting traps around SB 54. The message, shared by Cory Salzillo, a Warner lobbyist for the CSSA, suggested that the ACLU was using invitations to forums about the bill as a way to ambush sheriffs with hostile media.

“If this is a tactic that the ACLU is going to be using to promote their immigration agenda,” Robertson wrote, “I just thought you should be aware.”

The lobbying firm regularly forwards opportunities to work closely with the California Republican Party to undermine sanctuary protections. In February, Salzillo discussed the potential downsides of openly associating with Senate Republicans so early in the legislative process, as the state GOP was “ratcheting up their opposition to SB 54.” Donny Youngblood, the Kern County sheriff, agreed with limited public association, but noted, “Sheriff’s [sic] like me would be happy to stand with the Republicans.”

The lobby firm corresponded with the office of Republican Assemblymember Travis Allen on its sanctuary strategy. Allen, notably, is running for governor, and has cited opposition to sanctuary policies as a major issue in his campaign.

Orange County Sheriff Sandra Hutchens speaks during a news conference at Orange County Sheriff's Department headquarters in Santa Ana, Calif., Wednesday, June 28, 2017. Hutchens announced Tuesday that she's retiring and endorsing Undersheriff Don Barnes to take over the 3,800-member department. (Kyusung Gong/The Orange County Register via AP)

Orange County Sheriff Sandra Hutchens speaks during a news conference at Orange County Sheriff’s Department headquarters in Santa Ana, Calif. on Wednesday, June 28, 2017.

Photo: Kyusung Gong/The Orange County Register/AP

The sheriffs have also taken to conservative media to broadcast their message, appearing on talk radio and cable news to warn that SB 54 will lead to undocumented immigrants terrorizing communities.

In July, Orange County Sheriff Sandra Hutchens appeared on Fox News’s “Tucker Carlson Tonight” to declare that the bill “places Californians at risk of being impacted by these criminals who are getting released to the street.”

During her appearance, Hutchens and Carlson went through the usual litany of points against the bill, raising the specter of dangerous immigrants released from local jails and noting that if sheriffs can’t cooperate with ICE, immigration officials would raid local communities, potentially exacerbating tensions.

But Carlson raised an additional point: “If the state of California can say to the feds, ‘We are just ignoring your law,’ then why can’t Orange County say to the state of California, ‘We are ignoring your law?'”

Hutchens gave an eyebrow-raising response: Her office had already asked that question, she said, and they’ve reached out to their attorney to see if Orange County can simply violate state law. But, she added, “We would be subject to being prosecuted if we didn’t follow state law.”

The political dynamics appear to favor proponents of the sanctuary state bill; it has robust backing from nearly every high-profile Democrat in the state, buoyed by growing interest in opposing Trump’s deportation agenda.

But the California sheriffs have a long history of political victories. Last year, they successfully lobbied to defeat a state ballot initiative, Prop 62, to end the death penalty, while helping to pass a dueling initiative, Prop 66, that sped up the death penalty process. It was a stunning victory for law enforcement, despite being vastly outspent by death penalty opponents.

For the sanctuary state proposal, however, not all California sheriffs are completely united in the campaign. Jim Hart of Santa Cruz County is the only sheriff in the state to buck the sheriffs’ association and support SB 54. In a May 10 position letter sent to Senate Speaker Kevin de León, Hart wrote that “public safety is not enhanced when local law enforcement officers enforce immigration laws or act in a manner that causes suspicion within the diverse communities we serve.”

Top photo: A sheriff’s deputy (R) talks to an immigration detainee (L) in a high-security housing unit at the Theo Lacy Facility, a county jail which also houses immigration detainees arrested by U.S. Immigration and Customs Enforcement in Orange, California, on March 14, 2017.