After the officer was hit, the two suspects fled with a third man in a white Mustang, and Officer Marcano returned to his car, intending to go to the hospital with his girlfriend behind the wheel, Mr. Kelly said.

Image Officer Ivan Marcano Credit... NYPD

But within a block, the officer and the suspects crossed paths again. In their effort to escape, the suspects had crashed into a livery cab and tried to run away. After seeing the suspects again, Officer Marcano got out of his car and drew his gun, the police said.

“Holding his left hand over his wound, with his gun in his right hand, Officer Marcano moved to the middle of the street, took cover behind a livery cab, yelled to passers-by to get down and fired,” Mr. Kelly said. “He moved a second time, still holding his hand over his wound, to the west side of Harrison Avenue, where he took cover behind a parked car and fired another round at the suspects.”

It was unclear whether the suspects returned fire. Officer Marcano shot one in the head, killing him, the police said. The other two suspects split up and ran off. Officer Marcano chased one of them, but he got away. Both remained at large late Wednesday.

Officer Marcano, who began his career as a transit officer in 2007, happened upon an ambulance parked in the area and was taken to the hospital, Mr. Kelly said. The officer had a bullet lodged in his chest, the police said. The round had grazed his left arm, entered the left side of his chest, narrowly missing his heart, exited and re-entered his right side, where it ricocheted, fractured one of his ribs and lodged in the right side of his chest, the police said.