Officers Wenjian Liu and Raphael Ramos were sitting in their vehicle in the Bedford-Stuyvesant neighborhood of Brooklyn shortly before 3 p.m. when a man approached the car on the passenger side and opened fire. Both officers later died.
"The blood of 2 executed police officers is on the hands of Mayor de Blasio. May God bless their families and may they rest in peace," the Sergeants Benevolent Association tweeted.
De Blasio created controversy with his response to demonstrations about police relations with minorities, after a grand jury declined to indict an NYPD officer in the death of Eric Garner, a Staten Island man who died after he was put in a chokehold during an arrest for selling loose cigarettes.
The mayor, whose wife is black, said he has spoken to his mixed race teen son about how he should act if he is stopped by police.
In speaking about protesters who were arrested and charged with assaulting police during a demonstration in New York, de Blasio used the word "allegedly," which some in the NYPD seemed to take as a slight.
Patrolmens Benevolent Association president Patrick Lynch and de Blasio have been locked in a public battle over treatment of officers following the grand jury's decision.
Earlier this week, Lynch suggested police officers sign a petition demanding that the mayor not attend their funerals should they die on the job.
Some officers turned their backs on de Blasio tonight as he walked into the hospital where the two officers were taken after the shooting.
Lynch said at a news conference tonight that there is "blood on many hands," explicitly blaming the mayor and protesters.
"We tried to warn it must not go on. It cannot be tolerated," he said. "That blood on the hands starts on the step of City Hall in the office of the mayor.
"When these funerals are over, those responsible will be called on the carpet and held accountable," Lynch said.
At the news conference, de Blasio, appearing with NYPD Commissioner William Bratton, wiped tears away as he spoke, and said the city is "in mourning."
"I don't think it's the time for politics or political analysis," he said. "It's a time to think about families that just lost their father, their husband, their son."