Pathogens cause damage, and their elimination requires activation of the costly immune response. A highly economic defense strategy should thus be the behavioral avoidance of pathogens, as manifested in humans by all aspects of hygiene or revulsion at pathogen-rich material. Despite its potential importance, behavioral defenses have as yet received only little attention in biomedical research--in stark contrast to the physiological immune system. In the present study, the genetics of such behavioral defenses are elucidated in a simple model organism, the nematode Caenorhabditis elegans. We show for the first time that mutations in the insulin-like receptor (ILR) pathway lead to two distinct behavioral responses against pathogenic strains of the gram-positive bacterium Bacillus thuringiensis (BT), including the physical evasion of pathogens and their reduced oral uptake. Since this pathway also contributes to nematode stress resistance, the results surprisingly reveal a genetic link between physiological and behavioral defenses. Considering that many signaling pathways have conserved their functions across evolution, including the ILR pathway, this signaling cascade may represent an interesting candidate regulator for behavioral defenses in more complex organisms, including humans.