“Cops are not assuming that there will be another round of assassinations,” the second police official said. “But cops are wondering to what extent is there a climate where people feel emboldened to shoot at the police.”

The violent encounter in the Bronx began with a 10-30 call, a robbery in progress.

Two masked men had entered the Yemen Deli at East 180th Street and Webster Avenue, at 10:18 p.m., one brandishing a .44-caliber revolver and ordering those inside to the ground; the other, armed with a knife, vaulted a display of candy to empty two registers containing thousands in cash, a store manager, Ayad Almarah, said in an interview.

The robbery took less than two minutes. The men fled north carrying a black bag stuffed with cash.

At the 46th Precinct station house, Officers Andrew Dossi, 30, and Aliro Pellerano, 38, members of a plainclothes anti-crime team, were nearing the end of their shift, preparing to head home in roughly an hour, police officials said. When the call came in, they headed out with three colleagues in their five-person team to canvass the nearby streets.

The team approached a pair of men walking on Tiebout Avenue. The men and officers saw each other, the police said. Mr. Polanco went into the Chinese restaurant, Xin Xing, and Mr. Kemp stayed outside. Surveillance video shows Mr. Polanco ordering a Snapple iced tea and appearing to ready his weapon.

Officers Dossi and Pellerano approached Mr. Kemp outside, officials said, their feet visible on surveillance video through the window of the restaurant.