A bystander shot during an illegal gun sale involving an undercover NYPD officer has died. Two men have been arrested.

Police say Friday afternoon, an undercover cop met 28-year-old Jeffrey Aristy in the Bronx.

Aristy allegedly told the officer to drive north to Mount Vernon, and when they got to Beekman and Tecumseh Avenues, police say Aristy and another man robbed the officer.

"At that location, another male got into the car, there was some discussion, and a gun was put to our undercover's head. The undercover signaled to his back-up team, and engaged the subject who had robbed him. The suspect pointed the gun at the undercover, who then fired at the suspect," said NYPD Chief of Department James O'Neill.

The NYPD says the bystander, 61-year-old Felix Kumi, was also shot by the officer during the altercation.

He later died at the hospital.

"Mr. Kumi was blameless, and this tragedy has tested and tried his family. I pray that they may find comfort in their hope of resurrection and awakening, and I tender the Department’s support and service in their grief," Commissioner Bill Bratton wrote in a statement.

The second suspect was also shot by the officer and treated at the hospital.

Aristy fled the scene but was later caught. He is facing charges of criminal sale of firearms and criminal sale of a controlled substance for cocaine.

The undercover officer was not injured.

Police say the replica gun, which they say was a replica of a semi-automatic pistol, was recovered behind the house where the second suspect fled, along with the money the undercover officer gave to the second suspect.

According to the NYPD, Friday night's gun purchase was part of a longer-term operation involving a number of gun purchasers.