The Afanasev A-12.7 was a Soviet gas-operated, solenoid-fired .50 caliber heavy machine gun designed for use on aircraft, as a replacement for the Berezin UB. Developed to arm the Tupolev Tu-4 "Bull" heavy bomber, a Soviet copy of the B-29 Superfortress reverse-engineered from three aircraft that made emergency landings during WW2, it was already obsolete by the time it was ready and was never mounted in the Tu-4, being restricted to use in training aircraft and helicopters. The Tu-4 instead used the Nudelman-Suranov NS-23 23mm cannon.
Initially the A-12.7 was supposed to have a fire rate of 1,400 RPM with a mechanical sear, but this was found to lead to unacceptable barrel wear. An electrical sear was installed in production models which limited the rate of fire to about the same rate as the Berezin UB.
The gun was installed on training versions of the MiG-15, MiG-17 and MiG-19, but only saw combat use on helicopters: the Mi-4A, Mi-6A, Mi-8TV and Mi-24A all used it. The mechanism of the A-12.7 was influential, however, and was referenced by the later Afanasev-Makarov AM-23 and the Afanasyev-Yakushev cannons used by the ZU-23.