Authorities say a 51-year-old New York man who was shot to death by police near Times Square had a history of marijuana arrests and had once been taken to a hospital for observation after knocking down garbage cans.

Police identified the man as Darrius Kennedy of Hempstead, N.Y., and a native of South Carolina.

Kennedy was smoking marijuana near the military recruiting station in Times Square about 3 p.m. Saturday when officers first approached, police said. It was the beginning of an encounter that would stretch for seven of the most crowded blocks in New York City in midafternoon and end a few minutes later with 12 gunshots and many witnesses.

As officers spoke to Kennedy, he became agitated, pulled out an 11-inch knife and began to put a bandanna on his head, police said. He ignored repeated orders to drop the knife and began backing away from them, continuing for blocks as he waved the knife and drew many officers into a slow-speed pursuit that itself lured onlookers.

According to the police, officers pepper-sprayed Kennedy six times but he held onto the knife throughout, wiping the spray off his face. Finally, he lunged at police and two officers shot him in the torso, police said.

Kennedy was pronounced dead at Bellevue Hospital.

Kennedy had been arrested 10 times, including seven for marijuana possession. In 2008, he was taken to a hospital for observation after knocking down garbage cans in Times Square.