The police said that a 9-millimeter Glock handgun that had been stolen last year in Richmond, Va., had been recovered at the scene.
It was not clear why the officers had initially decided to follow Mr. Smith.
The police said that Mr. Smith, who gave his address as a homeless shelter on Staten Island and has relatives in the Bronx, has an extensive arrest record. He was awaiting sentencing next month on a weapons possession charge after he was caught with a handgun in a Brooklyn subway station, Chief Essig said.
“Here’s the problem,” Eric Adams, the mayor of New York, said at the news briefing, which was held at Lincoln Hospital. “The arrest was March 2020, and for 20 months after the arrest he remained on the streets.”
“The number of shootings we respond to every night is despicable,” Mr. Adams said.
The shooting was the latest in a series of attacks on police officers that have tested Mr. Adams, a former police captain and transit officer who has vowed to heighten public safety after increases in certain crimes amid the pandemic.