The Santa Clara County Sheriff’s Office allowed federal deportation officers to enter the jail it operates and interview four inmates this month in violation of the agency’s pro-immigrant sanctuary policies, officials said.

The interviews occurred March 7 and 8, around the time that U.S. Immigration and Customs Enforcement officers visited San Francisco County Jail and interviewed an inmate there in a breach of the city’s sanctuary rules, which restrict local cooperation in deportation efforts.

That incident prompted an apology from San Francisco Sheriff Vicki Hennessy. But while the recent ICE forays into the jails expose the growing tension between federal immigration authorities and many California leaders, the content of the interviews — and the potential consequences to the inmates — remains unknown.

Santa Clara County Sheriff Laurie Smith, in a statement to The Chronicle, said members of her staff “mistakenly” let ICE officers into the jail. After learning of the incident, she said, the office “reevaluated and strengthened the clearance procedures in which all law enforcement agencies are permitted to enter our facilities.”

Smith said none of the four inmates was detained by ICE.

“We value the trust and rapport we’ve earned with our local immigrant community and we will not break that trust,” the sheriff said.

ICE officials did not respond Monday to a request for comment, but said after the breach in San Francisco that officers were working under the Criminal Alien Program, which provides “direction and support in the biometric and biographic identification, arrest, and removal of priority aliens who are incarcerated within federal, state, and local prisons and jails.”

The interviews happened during the same week that Attorney General Jeff Sessions, in a speech in Sacramento, slammed policies that shield immigrants and announced a civil suit aimed at SB54, California’s statewide sanctuary law that took effect Jan. 1. Sanctuary policies, which critics call dangerous, seek to persuade undocumented immigrants to engage with local authorities.

Local jails have been a focus of the dispute, and the statewide legislation signed by Gov. Jerry Brown limits the circumstances under which jails can turn over undocumented inmates to the federal government.

Immigration experts said the ICE incursions in San Francisco and Santa Clara counties showed a need for more training for staff at local jails — and that federal officials were not keen on letting go of access to inmates.

“There needs to be better training and monitoring,” said Bill Hing, a professor at University of San Francisco’s School of Law. He said ICE officials are familiar with sanctuary policies across California, and perhaps wanted to test them.

Pratheepan Gulasekaram, a professor at Santa Clara University’s School of Law, said sanctuary policies are as strong as those who enforce them.

“You can have all the policies you want, but it ultimately comes down to individual officers who have to make decisions,” he said. “If they don’t have the commitment of the rule of law, then these policies are going to be paper policies.”

Jessica Vaughan, the director of policy studies at the Center for Immigration Studies, which supports strict immigration enforcement, called the decision to cut off ICE interviews disgraceful.

“Clearly they would rather punish the jail officer, who did the right thing, than punish a criminal alien, who has no right to be in the country and should be deported,” Vaughan said. “It’s good that the effects of these extreme sanctuary policies are coming to light, so that the public can see how absurd they are.”

Hennessy, the San Francisco sheriff, said it appeared ICE was “testing our defenses and found some weak points” when federal officers interviewed an inmate March 8. The incident, which is under investigation, led Hennessy to remind employees of sanctuary policies in a department-wide bulletin.

In both San Francisco and Santa Clara County, ICE officers returned to the jails after the initial interviews and were denied access, officials said. ICE visited Santa Clara County’s jail as recently as Monday and was denied, sheriff’s officials said. Gulasekaram and Hing speculated that the visits may have been designed to gather evidence in the Trump administration’s legal action against California.

John Sandweg, who headed ICE in 2013 under President Barack Obama, said the ICE access incidents could show that some sheriff’s employees want to work with ICE, though no evidence has emerged that the workers violated policy on purpose.

The visits are “ICE taking advantage of an opportunity,” Sandweg said.

The interviews in both counties also appeared to violate California’s Truth Act, which Brown signed in 2016, Gulasekaram said. The law mandates that before any ICE interview of a county jail inmate, a consent form be provided stating the reason for the interview, that it is voluntary and that an attorney can be present.

Amy Le, president of the Santa Clara County Correctional Peace Officers Association, said that the lapse in her county was a mistake.

“It was an honest mistake, a human error, and it was an oversight,” she said. “It was not an intentional thing.”