New York City will soon start declining requests by U.S. immigration authorities to detain immigrants for deportation proceedings unless a federal judge issues a warrant, after the City Council voted to pass new legislation on Wednesday.

Even with a warrant, the city's police department and Department of Correction would honor a U.S. Immigration and Customs Enforcement detention request only if the immigrant had been convicted of a violent or serious crime in the past five years.

Mayor Bill de Blasio has said he will sign the bill, which he called "thoughtful and progressive," into law, making the city the largest jurisdiction to challenge federal immigration authorities in this way.

Council Speaker Melissa Mark-Viverito said the law will lead to many more detainer requests being declined and will help keep New York families together.

"We also have no reason to expend scarce resources assisting in enforcing broken immigration laws," she said in a statement. The bill passed 41-6.

An ICE detainer request usually asks a jail, prison, sheriff or police force to hold an immigrant in their custody for up to 48 more hours until he or she can be taken away by ICE agents.

ICE, a law-enforcement agency under the U.S. Department of Homeland Security, says jurisdictions that ignore detainer requests undermine public safety.

The agency said in a statement on Wednesday that it asks for detention of only those immigrants who have been "arrested on criminal charges to ensure that dangerous criminals are not released from prisons or jails and into our communities."

New York City's Department of Correction handed over 3,047 people to federal immigration agents between October 2012 and September 2013, the City Council said. It denied 1,163 detainer requests during that period.