THE BRONX, N.Y. -- (WPIX) -- Plain-clothes officers shot a masked man in the Bronx Wednesday night when he pulled a gun on them, officials said.

They spotted him running on Loring Place near 183rd Street around 6 a.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 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.