These brave men were shot without warning, sitting in their patrol car while looking for crime, something every cop on the street does every day. They were like two shepherds guarding their flock, and they were brutally murdered for it.

This act has unleashed a torrent of anger and grief among the members of the Police Department, who take these vile murders personally, and a heartening outpouring of sympathy from ordinary New Yorkers, who instinctively grasp what it has meant at a moment when the police feel demonized, demoralized and, at times, literally under assault. But not everyone is so understanding. The gestures of protest by many officers toward Mayor Bill de Blasio — including turning their backs to him when he appeared at both officers’ funerals — have been characterized in some quarters as squandering the credibility of the department and reeking of self-pity.

When I hear this sort of thing, my blood pressure goes through the roof. Mr. de Blasio is more than any other public figure in this city responsible for feelings of demoralization among the police. It did not help to tell the world about instructing his son, Dante, who is biracial, to be wary of the police, or to publicly signal support of anti-police protesters (for instance, by standing alongside the Rev. Al Sharpton, a staunch backer of the protests). If there is any self-pity involved, which I doubt, it is only because we lack respect from our elected officials and parts of the media. It has taken two dead cops for some people to take a step back and realize what a difficult job cops have.

Most cops I know feel tired of being pushed to do more and more, and then even more. More police productivity has meant far less crime, but at a certain point New York began to feel like, yes, a police state, and the police don’t like it any more than you do. Tremendous successes were achieved in battling crime and making this city a much better place to live and work in and visit. But the time has probably come for the Police Department to ease up on the low-level “broken-windows” stuff while re-evaluating the impact it may or may not have on real, serious crime. No one will welcome this more than the average cop on the beat, who has been pressed to find crime where so much less of it exists.

Unfortunately this will require a mayor with far more finesse and political savvy and credibility with law enforcement than Mr. de Blasio appears to have. His statement on Monday that the New York City Police Department is the greatest in the world came too late. He should have been acknowledging our accomplishments months ago, instead of aligning himself with grandstanding opportunists. His words and actions before the killings of Officers Liu and Ramos showed a contempt for the police all too common on the left, and it is this contempt that the officers who have turned their backs to him are responding to.