The PRC was an enthusiastic user of the MiG-19, which it manufactured locally as the Shenyang J-6 from 1958. In August 1958 the People's Liberation Army requested development of a jet attack aircraft for the air support role.
Although based on the MiG-19, the new design, designated Qiangjiji-5 (fifth attack aircraft design), had a longer fuselage, area ruled to reduce transonic drag and accommodate a 4 m (13-ft) long internal weapons bay. Images of this internal weapon bay can be found in a Chinese Airforce movie. The air intakes were moved to the fuselage sides to make space in the nose for a planned target radar (which was never actually fitted). New wings with greater area and reduced sweep were incorporated. The Q-5 shares the J-6's Liming Wopen-6A (Tumansky R-9) turbojet engines. The redesign costs some high-altitude speed, but the Q-5 is as fast as the MiG-19/J-6 at low level, thanks largely to the area-ruled fuselage.
Fixed armament of the Q-5 was reduced to two Type 23-1 23 mm cannon with 100 rounds per gun, mounted in the wing roots. Two pylons under each wing and two pairs of tandem pylons under the engines were provided in addition to the weapons bay. A total of 1,000 kg (2,205 lb) of ordnance could be carried internally, with an additional 1,000 kg externally. On many aircraft the weapons bay is now used primarily for an auxiliary fuel tank.
The first prototype was completed in 1960, but the political climate in China resulted in the project being canceled in 1961. A small team kept the program alive until it was re-opened in 1963, when production was shifted to Nanchang. The first flight finally occurred on 4 June 1965. Series production began in 1969, with squadron delivery starting in 1970.
About 1,000 aircraft 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; these are believed to retain their internal weapons bay. A long-range Q-5I, introduced in 1983, added a fuel tank instead of the internal weapons bay, compensating for that with the provision of two additional underwing pylons. Some of these aircraft serve with the PLA Navy, and have apparently been equipped with radar to guide anti-ship missiles. Subsequent minor upgrades include the Q-5IA, with a new gun/bomb sighting system and avionics, and the Q-5II, with radar warning receiver (RWR).
In the 1980s, the 'Fantan' was exported to nations such as Pakistan, Bangladesh, Myanmar and North Korea, and is often known as the A-5 in those nations.
Plans for an upgraded Q-5/A-5 with Western equipment and new navigation and attack (nav/attack) systems were largely aborted following the Tiananmen Square protests of 1989, but the 'Fantan' continues in service. It is a capable light attack aircraft, although its limited navigation and weapons-delivery systems are inferior to more modern aircraft.
In more recent years, the PLAAF has begun to field newer models of the Q-5, that incorporate some of the technology developed during the canceled Q-5M and Q-5K projects. The Q-5 introduces a nose-mounted laser rangefinder, and a laser designator is also likely to be fitted since the aircraft is said to be able to deliver laser-guided bombs. The Q-5A variant is believed to be capable of delivering nuclear munitions. The Q-5D is an upgrade with new avionics, including a HUD and a new navigation system. The Q-5E and Q-5F models are reportedly being worked on, though little is known about them at this time. One of them could potentially be the new two-seater that has been seen in a few photographs, although the two-seater could bear the designation Q-5J