A man scrawling graffiti inside a downtown subway station pulled out a gun and began shooting when confronted by police Friday, killing at least two people and wounding five before being shot and subdued by officers.

Mexico City Attorney General Miguel Angel Mancera said a passenger and a police officer were killed at the Balderas subway station, near the Ciudadela crafts market. He said six people, including the shooter, were wounded.

Mancera identified the gunman as Luis Felipe Hernandez Castillo, 38, and said he was arrested carrying a .38-caliber revolver.