Tactile stimulation of the siphon and mantle shelf in Aplysia causes a characteristic withdrawal response of the external organs of the mantle cavity. A similar response also occurs spontaneously. Both responses are mediated by the abdominal ganglion and therefore provide an opportunity for correlating cellular functioning and behavior in a relatively simple and well-studied neuronal system. The withdrawal responses are controlled by five identified motor cells which receive two types of synaptic inputs. One set of excitatory connections, activated by tactile stimulation of the siphon and mantle shelf, mediates the defensive withdrawal reflex. A second set of connections is activated by a spontaneous burst of activity in a group of closely coupled interneurons which are excitatory to some of the motor cells and inhibitory to the others. This second set of connections mediates the spontaneous withdrawal response. These two inputs can therefore switch the same population of motor cells from a simple reflex to a more complex, internally organized response.