“No cop goes out in the morning and says, ‘Hey, I’m going to go kill someone in the stairway,’ ” he said. “Every cop you meet could give you a litany of examples of times they wish they had drawn their gun, and didn’t, and times when they did draw their gun and later learned it was unnecessary.”

To civilians, the vision of armed officers ready to fire can create “unnecessary anxiety,” according to the Los Angeles Police Department’s policy on drawing weapons, particularly when the encounters fall outside an emergency. Departments in Las Vegas, Denver and elsewhere have wrestled with the risks — including accidental discharge — of too quickly drawing a gun.

Every year in New York, the independent agency that investigates allegations of police abuse receives hundreds of complaints from people shaken when officers point guns at them. Workers who maintain public housing buildings — repairing the broken lights that make the hallways dark — sometimes worry as much about armed officers as criminals.

What makes one officer comfortable without a gun in hand is sometimes a matter of experience.

“It is an individual judgment,” said Robert J. Louden, who retired from the New York police force as a lieutenant and is now a professor at Georgian Court University in New Jersey.

But there is no fail-safe way — despite lectures, tactical drills and hours of target practice — to “develop cops who will use their discretion well,” Mr. Henry said. Often, younger officers learn from older ones.

Precisely why, and how, Officer Liang fired his 9-millimeter gun is under investigation. The officer has not provided his account to an investigator, which is typical after a shooting in which the case may be presented to a grand jury.

One possibility is that he tried to turn the knob of the door to the stairwell with his left hand, which also clutched his gun.