The pro- and mesothoracic ganglia were found to inhibit cercal grooming behaviour controlled by the metathoracic ganglion. After nerve cord transection between the meso- and metathoracic ganglia, repetitive grooming movements with the metathoracic legs spontaneously occur. In experiments where the head and thoracic ganglia were serially excised, maximum activity occurred when all ganglia anterior to the metathoracic were removed. Stimulation of cercal afferents has long been known to induce evasive behaviour involving giant interneurons, but in animals with the nerve cord sectioned between the meso- and metathoracic ganglia, cercal stimulation increased cercal grooming behaviour. With asymmetrical cercal stimulation, the homolateral metathoracic leg engages in significantly more cercal grooming activity than the heterolateral metathoracic leg, thus indicating that this spontaneous activity can be modified by sensory input. When cercal afferents are stimulated with the anterior thoracic ganglia present, the metathoracic legs are coordinated in evasive running movements. With the anterior thoracic ganglia removed, the same type of cercal stimulation induces increased grooming activity with the metathoracic legs rather than running movements. The ventral nerve cord posterior to the head ganglia is preset, therefore, for escape rather than grooming activity when the cerci are stimulated, with cercal grooming continuously inhibited by the anterior thoracic ganglia. Simultaneous electrophysiological recordings from the metathoracic nerve 5 and the abdominal nerve cord showed that the efferent motor rhythm for grooming behaviour is independent of ventilative activity, also known to originate in the metathoracic ganglion. Spike patterns during grooming movements showed that different groups of levator and depressor neurons were alternatively active. Carbon dioxide concentrations which stimulated the metathoracic ventilative output caused a breakdown of cercal grooming activity, thus indicating a basic difference in the neural mechanism producing the two rhythms.