SAN FRANCISCO (KPIX 5) — San Francisco Sheriff’s deputies have been making secret phone calls for years to help the Feds get illegal immigrants like murder suspect Francisco Sanchez, off the streets.

One former cop said it happened all the time because they “resented” the city’s so-called ‘sanctuary policy‘ and they wanted to get illegal immigrant criminals off the streets. Then, Sheriff Ross Mirkarimi got wind of it.

KPIX 5 obtained the memo Sheriff Mirkarimi sent to his deputies in March spelling out that he, and only he, can turn over illegal immigrants to Immigration Customs Enforcement (ICE).

He sent the memo to all sworn personnel. It basically told them to stop going rogue.

RELATED: Donald Trump Pledges To ‘Secure Our Border’ Following San Francisco Pier 14 Fatal Shooting

“Being able to say, I’ll call ICE for this guy, but not call ICE for that guy or that woman or not that woman that doesn’t make any sense,” said Sheriff Mirkarimi in an interview Monday.

“While that might feel uneasy, uncomfortable and counterintuitive to a line Deputy Sheriff and line officer, the federal courts and conditions have changed, and absent a comprehensive policy on a federal level — we’re trying to reconcile that,” he said

Long before Sanchez opened fire and killed 32-year-old Kathryn Steinle on Pier 14, San Francisco’s sanctuary city status has been a source of contention.

Sheriff Mirkarimi says the policy is clear: He needs a court order or a warrant.

In Sanchez’s case, ICE only asked for a detainer, which the sheriff said, under city law, isn’t good enough.

“Local governments have the right to require a legal instrument such as a court order or a warrant,” he said.

ICE has no city by city breakdown. But statewide, in the last 18 months more than 10,000 undocumented immigrants have been released from custody in California without immigration officials being notified.

ALSO READ: Bay Area’s Over-The-Top Real Estate Market Stars On ‘Million Dollar Listing San Francisco’

Sanchez, 45, had seven felony convictions, but none recent and none violent when he was released by San Francisco authorities despite an immigration hold on the Mexican national who had been deported five times before.

The Sheriff turned the tables on ICE, saying, they are the ones that need to make sure they get it right.

“If ICE does not provide the proper legal instrument, they are jeopardizing also the city’s ability to detain somebody against their will,” he said. “We need ICE to step up, and I hope this doesn’t happen in other cities, but there’s a good chance it can.”

ICE said they issue nearly 200,000 detainers a year, and getting a warrant for each one is impossible. The judicial system would collapse under that kind of volume.