It is the kind of nervous moment that almost any New Yorker would recognize, the reason that even in a city where crime is at historic lows, direct eye contact is sometimes not considered the wisest maneuver.

A man, angry and ranting in a public place. It could be on the subway, on a street corner or in a shop. In most cases, it is just a fleeting incident in a very big city, a brief reminder that it is a good idea to keep your wits about you.

On Wednesday morning, however, it ended with blood on the streets after a man lunged at a police officer with a knife and was shot dead by other officers. One woman, a bystander, suffered a minor wound after being grazed by a bullet.

It was shortly after 8 a.m. when a man later identified by the police as Garry Conrad Jr., 46, of Upper Manhattan, entered the Food Emporium grocery store at 49th Street and Eighth Avenue. He was disheveled and agitated.

Video

A man was shot and killed in Midtown Manhattan, near Times Square, on Wednesday morning, the New York Police Department said.Published OnMay 18, 2016CreditImage by Lucas Jackson/Reuters

He wanted to buy beer. But as he shopped, he threatened customers, officials said.

“He became aggressive and belligerent,” said James P. O’Neill, the chief of department for the New York Police Department. “He was swearing at the people in the store.”

As Mr. Conrad was going to pay, his confrontation with the cashier escalated.

“She asked to see some I.D.,” Robert K. Boyce, the chief of detectives, said.

A retired state law enforcement officer in the store thought it best to find a police officer and flagged down one, who was on foot patrol. At the same time, employees of the Food Emporium forced Mr. Conrad from the premises, the police said.

On the corner of 49th Street and Eighth Avenue, the officer engaged him, grabbing him by his backpack. They both went crashing to the pavement, the police said.

“As the suspect got back on his feet he displayed an 8-inch knife and approached the officer and two other officers who were coming to his assistance,” Chief O’Neill said. The man was ordered to drop the weapon but refused, he said.

Image

The man who was shot was ordered to drop an 8-inch knife but refused, the police said.CreditNew York Police Department

At that point, another officer rushing to the scene fired seven rounds at Mr. Conrad, and a police sergeant fired two more rounds at him, according to the police. Their names were not released. It was unclear how many times Mr. Conrad was struck, but he fell to the ground and was pronounced dead at the scene.

The police said that they expect to find video recordings of the episode, but all indications were that the shooting was justified.

The bystander who was injured, a 46-year-old woman, was standing north of the point of the shooting. The police described her injuries as minor.

The officer who wrestled Mr. Conrad to the ground suffered a cut to his hand.

That attack also took place in broad daylight on a crowded city street, and as was the case then, the crime scene on Wednesday quickly turned into a public spectacle. Diners at a nearby cafe, Pigalle, were startled by the gunfire, setting down their coffee and their croissants and going out onto the street to see what had happened.

Guests at the Hilton Garden Inn peered from their hotel windows as the police draped a white blanket over the dead man, his blood staining the pavement.

Christopher Mele contributed reporting.

A version of this article appears in print on , on Page A22 of the New York edition with the headline: Police Fatally Shoot Man Wielding a Knife on a Midtown Manhattan Street. Order Reprints | Today’s Paper | Subscribe

Sign up for the New York Today Newsletter

Each morning, get the latest on New York businesses, arts, sports, dining, style and more.