The chairman of the City Council’s courts and legal services committee urged Mayor Bill de Blasio Tuesday to order the NYPD to stop arresting suspected petty offenders like fare beaters, saying the practice endangers immigrant New Yorkers for deportation under the policies of President Donald Trump.

Flanked by civil libertarians and attorneys who represent the poor, Councilman Rory Lancman (D-Queens) said the NYPD should instead charge those offenders with civil offenses. Doing so wouldn’t result in fingerprints and other personal information automatically going to the federal government under criminal arrest procedures.

“Bill de Blasio’s broken-windows policing is the fuel for Donald Trump’s deportation machine,” he said.

Broken windows — the idea that aggressively policing petty crime averts bigger offenses — has guided the NYPD for decades. The department credits the practice with driving down crime from record highs in the early 1990s.

In 2015, Lancman said, about 100,000 people were stopped by the police for fare evasion, 30,000 of whom were arrested, and the remainder given what is essentially a civil summons.

De Blasio spokesman Austin Finan said quality-of-life policing is driven by public complaints and “only repeat offenders and those with outstanding warrants are subject to arrest for fare evasion.”

Lancman questioned whether the mayor is living up to his promise, made in the aftermath of Trump’s victory, to keep New York a “sanctuary city” in the wake of the president’s promised crackdown on immigration.

“Thousands, if not tens of thousands of New Yorkers, are at risk of deportation, and if talk was always cheap, after Donald Trump’s election, it is now practically worthless without action backing it up,” Lancman said of de Blasio, a fellow Democrat.

Lancman’ was joined Tuesday afternoon by representatives of various public defender offices and the New York Civil Liberties Union.

He said the police should still stop a public urinator or other quality-of-life offender, while Tina Luongo, attorney-in-charge of the Legal Aid Society’s criminal practice, said the person should not be stopped by police at all.

“We have clients, people, humans, immigrant neighbors, right now on pending cases,” she said. “And the system is just continuing to do it the way we’ve always done it.”