The Q-5 started as a design from Shenyang in 1958, a development of the Soviet MiG-19 Farmer. Shenyang's team re-designed the aircraft for the low-level role primarily by changing the air intakes to a side-mounted position to leave the nose free for targetting radar. The project was cancelled in 1961, but a small team kept it alive until it was re-opened in 1963, but production was shifted to Nanchang where the first prototype flew in 1965. Production began in 1969 and deliveries in 1970.
About 1,000 jets were produced, 600 of them being the updated Q-5A. A small number, perhaps a few dozen, Q-5As were modified to carry nuclear weapons. In the 1980s, the plane was exported to nations such as Pakistan, Bangladesh and North Korea, and is often known as the A-5 in those nations.
It continues to serve in the Air Forces of these nations, and is still a capable attack plane, although its avionics require upgrading to keep it up to par with other planes.