With criticism of the police infusing the Democratic race to succeed him, Mayor Michael R. Bloomberg on Tuesday offered a staunch defense of the New York Police Department, as well as a spirited attack against its critics.

Mr. Bloomberg, speaking at Police Headquarters, took a swipe at those suing the department in Federal District Court in Manhattan over the stop -and-frisk practices. But he saved his strongest words for legislators and mayoral candidates “playing politics with people’s lives.”

“Look at what’s happened in Boston,” he said. “Remember what happened here on 9/11. Remember all of those who’ve been killed by gun violence and the families they left behind.”

The mayor described criticism of the police as politically motivated. “The attacks most often come from those who play no constructive role in keeping our city safe but, rather, view their jobs as pointing fingers from the steps of City Hall,” he said.