By Tim Henderson

Carlos Rodriguez, a 27-year-old Dominican-born chef in New York City, thought he was safe from deportation because his wife and daughter are U.S. citizens and he had never been in trouble with the law.

Then he was arrested for trespassing in a friend's apartment building last year, a charge that was later dropped. It was the beginning of an eight-month nightmare that started when immigration authorities took him into custody and worsened when they moved him to a detention center in New Jersey to await deportation. Because his wife is a citizen, Rodriguez qualified for a green card, but he didn't know that until an advocacy group stepped in to help. Eventually he was freed from detention and allowed to remain in the country.

"I lost my job as a chef and my wife and daughter were about to lose the apartment because they depend on my job for the rent," Rodriguez testified recently at a New York City Council meeting.

New York City decided in 2011 to limit or refuse cooperation with federal "detainers," or requests from immigration authorities to hold someone for possible deportation. Almost 300 cities and counties plus the states of California, Colorado and Connecticut have done the same, according to the Immigrant Legal Resource Center, which tracks them.

A Stateline comparison of the center's list with U.S. Census data shows that more than half of the nation's 22 million noncitizens live in those jurisdictions, including such immigrant strongholds as New York City, Los Angeles and Miami. But other areas also with large noncitizen populations, including Harris County, Texas (which includes Houston), and Maricopa County, Ariz. (Phoenix), do cooperate, at least officially.

The detainers are notices from U.S. Immigration and Customs Enforcement (ICE) requesting local police to hold a prisoner an extra two days for possible deportation, after the prisoner would ordinarily be released because the charges were dropped or bail was posted. In some cases, prisoners have been jailed longer _ sometimes months _ because bail was refused based on the detainer, or in some cases, prisoners opted not to post bail, hoping to postpone federal custody and deportation.

Federal immigration authorities began to use detainers in 1996. They became more common for more minor arrests when the Secure Communities deportation program, which became mandatory in 2012 after four years as a pilot program, required state and local law enforcement agencies to send fingerprints from every booking to immigration authorities for checks.

New York City was one of the first jurisdictions to question the detainers, said Peter Markowitz, director of the Immigration Justice Clinic in New York and co-author of a 2011 Berkeley Law School study of Secure Communities that became the basis for many arguments against detainers.

"It's really gone from 0 to 60," he said about the move to limit or refuse to cooperate. "A few years ago, nobody was doing it, then a few places like Santa Clara County, Calif., and New York City, and now there's just an explosion." Markowitz said state and local officials began to balk when they saw that many people were deported even though they had not committed serious crimes.

ICE says it deports about 133,000 people annually from the interior of the country, as opposed to deportations of those caught trying to cross the border, and that most of them have criminal histories. But criminal history can include strictly immigration-related cases like failing to show up in immigration court, or "recent border crossings," according to ICE.

"A large percentage of these people have no criminal record," said Markowitz. "Many of the people we represented were afraid of any kind of contact with authorities because of the close ties between New York City police and ICE."

But many jurisdictions are still cooperating with the detainers, sometimes resulting in different outcomes for immigrants even in the same state. Baltimore Mayor Stephanie Rawlings-Blake, for example, has aggressively resisted detainers, saying she welcomes immigrants, but nearby Frederick County, Md., is one of the most cooperative jurisdictions.

"We all know there are people out there advocating that we not enforce any laws whatsoever," said Frederick County Sheriff Charles "Chuck" Jenkins.

"If you're arrested for any crime in my county, we put you in handcuffs and we ask you two simple questions: 'What country were you born in?' and 'What country are you a citizen of?'" Jenkins said. "Everybody is treated the same."

Frederick County is part of the 287(g) program, an enhanced partnership program with ICE that trains and uses local law enforcement to carry out some federal immigration laws, such as determining when a detainer is warranted. Since 2008, county officers have filed 1,311 immigration detainers, usually resulting in a transfer to federal authorities for possible deportation, although they don't know how many actual deportations result.

At times, policies can clash within the same jurisdictions. Rhode Island Democratic Gov. Lincoln Chafee in July ordered state prisons and jails not to hold immigrant detainees for extended periods of time for possible transfer to ICE. This allowed one of them, Antonio Mejia of Mexico, to post bail for his charge of driving without a license after seven months in jail, and return to his fiancee and her children.

"It was a very difficult time for his family, including his parents in Mexico who depend on the money he sends," said Will Lambek, one of the activists who pushed for a policy change on behalf of Mejia. "The faith and power of an organized community really paid off."

At the same time, however, county sheriffs guarding courts allowed immigration officials to take prisoners directly from courthouses, resulting in the detention of another young man with a wife and children in the community, Lambek said. That loophole was closed, but too late to stop the deportation of Gustavo Arroyo of Guatemala.

Stories of mistreated immigrants and lawsuits holding localities responsible for civil rights violations have led some communities to rethink whether they should cooperate with immigration authorities.

Even Frederick County no longer holds immigrants for any longer than the original local charges warrant, after a federal court in 2013 found that Jenkins, the sheriff, erred in detaining a Salvadoran immigrant named Roxana Orellana Santos in 2008. Santos was questioned as she ate a sandwich outside her workplace, and officers gestured for her to remain seated while they checked her status, finding an immigration warrant. The court ruled that this warrant "did not provide the deputies with a basis to arrest or even briefly detain Santos."