This is not the first police attack in New York in recent days.
A New York police officer who worked on a robbery patrol in Brooklyn was stabbed in the neck by a man who crawled up behind him, police said.
The attack turned into a shootout, during which the attacker was injured. Two other police officers also received gunshot wounds.
The bloodshed occurred shortly before midnight during a curfew imposed to end the unrest of many days in connection with the death of George Floyd in Minnesota.
All three wounded policemen are expected to recover. The attacker received numerous gunshot wounds and was hospitalized in critical condition, said Police Commissioner Dermot Shay.
He noted that in recent days there have been several attacks on police officers. During one of them, a car driver ran into a police sergeant who was trying to stop the robberies in the Bronx. In another case, a lieutenant was hit with a brick on a helmet during a fight with protesters in Manhattan.