This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

UNIVERSITY HEIGHTS, the Bronx — Plain-clothes officers shot a masked man in the Bronx Wednesday night when he pulled a gun on them, officials said.

Investigators told PIX11 the incident started with an alleged botched drug deal that led to a foot chase before ending with three people shot; two of which were bystanders.

They spotted him running on Loring Place near 183rd Street around 6 p.m., NYPD Chief of Department Terence Monahan said. After he pulled out a gun, one officer chased him on foot and they exchanged gunfire. The other officer got into a car and followed.

He was shot in the neck and foot, police said. He was taken into custody near 152 West Fordham Road. The man was taken to a local hospital and is not likely to die.

A gun was recovered at the scene of the shooting. (NYPD)

A 45-year-old woman and a 12-year-old girl — both bystanders — were also injured, officials said. The woman was shot in the stomach and the girl has bullet fragments in her leg. They are both in stable condition.

Monihan said it’s unknown if the bystanders were injured by police gunfire or shots from the masked man. Ballistics tests will be done.

No identifying information was immediately available.

A gun was recovered at the scene, police said. Officers also found a brick of narcotics in the suspect’s backpack.

Surveillance video shows the man was involved in what appears to be a drug deal in a Bronx lobby on West 183rd Street before the shootout on the street, Monahan said. He fired at individuals inside a Bronx building lobby.

“This man was running down the street indiscriminately firing. He started shooting at people in that building, immediately fired at the cops, and continued firing at the cops,” Monahan said. “So yea, he was creating a dangerous situation.”

The officers involved were not injured, but they were taken to a local hospital for observation.