Mayor de Blasio’s eviction of ICE from Rikers Island as part of his Sanctuary City law has helped illegal immigrant convicts evade deportation — and made ICE agents’ jobs far more dangerous, sources told The Post Wednesday.

“They were [at Rikers] to interview people and identify criminals who are in the country illegally right there and then, and issue detainers,” said a federal official.

“Now they have to find someone when they don’t know where they are. It’s a needle in a haystack.”

The Immigration and Customs Enforcement agents were assigned to Rikers in 2003 under the Criminal Alien Program, which was supported by then-Mayor Michael Bloomberg.

Up to 15 agents worked closely with Department of Corrections staff, and could monitor inmates and issue detainer orders for illegal immigrants on their radar.

Corrections would then keep the inmates locked up after their release date until ICE could take them into custody.

Sources said the Rikers program was effective, although the NYCLU charged that it targeted too many nonviolent or even innocent people among the up to 3,000 a year who were detained.

But de Blasio gave the agents the boot in late 2014. They pulled out of the jail in February 2015.

Sources said their eviction puts ICE agents in the field and bystanders in greater danger because they now have to track the illegals down — running the risk of violent standoffs with dangerous fugitives.

“These are known criminals who don’t want to be found,” said a law-enforcement source.

“And for many of them, it’s worse to be picked up by ICE than by the NYPD,” the source said, referring to the threat of deportation.

A Corrections official agreed the program’s demise was a mistake.

“They practiced a more hand-on approach when they were at Rikers. Now that’s gone. It’s always better to be more hands on when you’re dealing with criminals because they slip through the cracks,” the official said.

An example came this week, when confessed gangbanger Estivan Velasquez, 19, walked out of Rikers scot-free Feb. 16 after serving time for disorderly conduct — because the city ignored an ICE detainer petition.

The feds were able to track him down that same day in Queens.

NYPD cops lashed out at the de Blasio administration’s refusal to cooperate with ICE.

“Detainer requests are like broken windows [policing] — stop someone before he does something more serious. It is a privilege to live in this country, not someone’s right. Is asking someone to not commit a crime asking too much?” a Queens detective asked.

Another was astonished that the city refused to hold Velasquez — who admitted he was a member of the brutal MS-13 El Salvadoran gang and had a rap sheet that included a weapons charge.

“It is ludicrous. Why doesn’t de Blasio ask the people who live next to the gang member if they want him to live next door. I am sure they live in fear. Is that OK?” said the cop, who works on Staten Island.

Last year, ICE sent 72 detainer orders to the NYPD, which rejected all but two of them.

An NYPD official defended the lack of cooperation.

“We have very strict and established criteria in New York City by which we assess any detainer requests from ICE,” including the formal request and a warrant from a federal magistrate.

Police Commissioner James O’Neil said that policy won’t be changing, and that the department will not enforce warrants or orders issued by ICE for civil immigration violations.

“The NYPD does and will continue to honor federal immigration detainers when there is a risk to public safety,” he added.

ICE officials declined to comment Wednesday.

But Thomas Decker, the ICE field director in New York, slammed the city the day before, saying that complying with a detainer request was a matter of public safety.

Team de Blasio scoffed at the feds’ concerns — the same day President Trump ordered sweeping changes in how immigration laws would be enforced, reversing many of President Obama’s more lenient policies.

Additional reporting by Bob Fredericks