Hundreds of people were arrested across the country by Immigration and Customs Enforcement officers this week, including 82 in the New York region, as part of the agency’s campaign against sanctuary cities.

The New York region includes the city, Long Island and five upstate counties. The agency said that 42 of those arrested had been released by the NYPD and other area law enforcement agencies, even though they were wanted by ICE and had been charged with offenses including rape, sexual assault, and possessing child pornography.

Thomas Decker, director of the New York region’s office, called this a “terrible” policy.

“They’re just releasing people back out into the community,” Decker said, noting that all but one of the people ICE sought were either charged with or convicted of crimes.

New York City local law prevents police and jails from honoring detainer requests from ICE, which would require holding someone past 48 hours in order to facilitate a transfer of custody. There are exceptions if the person has been convicted of, but not merely charged with, one of 177 serious offenses in the past five years (that includes seven new crimes added this year). There also has to be a warrant signed by a federal judge.

City officials have defended this limited cooperation by noting a 2018 appellate court ruling that found that local law enforcement holding someone beyond their release date in order to transfer them over to ICE is a violation of state law.

New York City Immigrant Affairs Commissioner Bitta Mostofi also said the current local law allows limited cooperation with ICE when someone has been convicted of a serious crime. “We’ve struck the right balance around advancing public safety interests while building and maintaining trust with communities,” she said.

The Trump administration has been in an open conflict with these policies for years.

In a sit-down interview with WNYC/Gothamist, Decker criticized New York City’s local law, which dates back to 2014. He said those arrested this week included two people accused of raping someone under the age of 17, and another accused of illegally possessing a weapon. He said his office could have arrested 2,900 people in the past year if NYPD cooperated.

“We placed detainers on all 2,900,” he said, but “none were honored.”

Mostofi countered that the NYPD did share information with ICE about seven individuals in its custody who had at least one conviction for a serious crime. And 22 people were transferred to ICE custody from the city Department of Corrections over the last year.

Decker also took issue with the law’s requirement that ICE get a warrant signed by a judge before arresting someone at a city jail or police station. The state office of court administration has a similar policy. “What's put out there is just the advocate groups, the politicians saying ‘Oh get a judge's warrant, get a judge's warrant.’”

ICE can only arrest people for being in the country illegally, which is a civil, not a criminal violation, and thus cannot lead to a warrant. Exceptions include someone who re-entered the country illegally (which is a felony) or if they were charged as the result of an investigation by ICE’s Homeland Security Investigations.

New York’s Office of Court Administration said six ICE arrests were made this year inside New York State courthouses, all using judicial warrants. The most recent one was in June in Queens Criminal Court.

ICE’s policy of arresting hundreds of people inside and outside courthouses has been so widely criticized that the New York State Attorney General, the Brooklyn District Attorney and immigration advocates filed two lawsuits this week. They claim the growing number of these arrests since Trump took office scare victims and witnesses from working with law enforcement and from attending court dates.

Decker said those people should not feel afraid. “We’re not going after someone who's a victim, we're not going after someone who's a witness,” he explained.

Asked about a 2017 case in which WNYC witnessed ICE trying to arrest a Chinese woman charged with giving an illegal massage who was in a Queens courtroom for victims of human trafficking, Decker suggested that was a mistake. “Once we found out that was a victim court we worked with the court administrator and we never went there again.”

Questioned about ICE’s policy of targeting people who have not been afforded due process, Decker replied, "If we identify them as a removable alien, doesn't that person, shouldn't that person go through the immigration process? So we're being denied that process.”

Decker said ICE goes to courthouses to find people charged with crimes because the police and jails won’t cooperate.

It bothers me that you have the attorney general and a Brooklyn district attorney who are supposed to be law enforcement, is working against law enforcement. That bothers me.”

But Hasan Shafiqullah, attorney-in-charge of the Legal Aid Society’s immigration law unit at the Legal Aid Society, said ICE continues to target a wide range of immigrants attending court.

Shafiqullah said they include “those accused of a crime; parents appearing in child support matters; survivors of domestic violence, sexual assault, human trafficking, and other crimes. Any assertion to the opposite is a blatant misrepresentation of the truth.”

Due to an editing error, a previous version of this story stated that 22 people were transferred to ICE custody from the state Office of Court Administration over the last year. The transfers were in fact from the city Department of Corrections, and the story has been updated accordingly.

Beth Fertig is a senior reporter covering courts and legal affairs at WNYC. You can follow her on Twitter at @bethfertig.