Selection of behavioral responses to external stimuli is strongly influenced by internal states, such as intentions and expectations. These internal states are often attributed to higher-order brain functions. Yet here we show that even in the simple feeding network of Aplysia, external stimuli do not directly specify which motor output is expressed; instead, the motor output is specified by the state of the network at the moment of stimulation. The history-dependence of this network state manifests itself in the same way as do intentions and expectations in the behavior of higher animals. Remarkably, we find that activity-dependent plasticity of a synapse within the network itself, rather than some higher-order network, mediates one important aspect of the change in the network state. Through this mechanism, changes in the network state become an automatic consequence of the generation of behavior. Altogether, our findings suggest that intentions and expectations may emerge within behavior-generating networks themselves from the plasticity of the very processes that generate the behavior.A nimal behavior is not merely a passive response to external stimuli; rather, it expresses also the internal state of the animal. This internal state is presumably somehow embodied in the state of the nervous system. Here we study the manifestations and the neurophysiological basis of the internal state in the experimentally advantageous feeding network of the mollusk Aplysia.State-dependence of network function is not a new concept. In the neurophysiological literature, state-dependence is typically discussed as the ability of contextual cues to modify the response to a stimulus. This type of state-dependence has been demonstrated, for example, for locomotion by using stimulation of the mesencephalic locomotor region to elicit walking in the decerebrate cat. The speed of locomotion is determined by the speed of the treadmill on which the cat is placed (1). In another compelling example, stimulation of a command-like neuron in a leech immersed in water elicits swimming, whereas stimulation of the same neuron when the leech is placed on solid substrate elicits crawling (2). Similarly, stimulation of a command-like neuron in a cricket suspended in air elicits avoidance responses but it fails to do so when the cricket is placed on the ground (3). State-dependence of this type is also seen with neuromodulation. For instance, the ability of sensory stimulation to elicit stridulation in the grasshopper is critically dependent on the presence of a muscarinic agonist (4). The setting of network state by application of neuromodulators is a common phenomenon that has been well characterized in simple neuronal networks, such as the stomatogastric system of crustaceans (5-9).This type of state-dependence fails, however, to account for a fundamental feature of the state-dependence that is observed in animal behavior and human psychology. In the type of statedependence just discussed, the behavior is still unambiguously specified by the ext...