“The reason we are there,” he said, “is because people in those developments want us there.”

The victim in this case, identified as Akai Gurley, 28, was unarmed and appeared simply to be heading out into the frigid night with his girlfriend. Mr. Gurley was hit by a shot from the gun of Officer Peter Liang, who had less than 18 months of experience and who was assigned to a violence reduction detail at the housing complex, the authorities said.

At the time, Officer Liang and a partner were conducting a so-called vertical patrol of the building. Following standard procedure, they took the elevator up to the eighth floor and began to work their way down. Peering into the stairwell, though, they encountered near pitch darkness, the authorities said.

Officer Liang turned on a flashlight, then pulled out his gun.

Just as the officers were entering the stairwell, though, Mr. Gurley and his girlfriend came onto the seventh floor landing a floor below, the police said. A shot rang out and Mr. Gurley was dead. Mr. Bratton described the shooting as an “accidental discharge,” and suggested that Officer Liang had never intended to pull the trigger.

A lack of lighting in buildings can be a sign that criminal activity is afoot, and officers are taught to be extra vigilant in such circumstances, said John C. Cerar, a retired New York deputy inspector who was the commander of the department’s firearms training. Pulling out a gun, he said, is well within protocol.

“It brings the police officer to a higher standard of protection when it’s dark,” he said. “I think all of us would rather be in an area that is lit rather than unlit.”