The gastrointestinal tract is the central organ for uptake of fluids and nutrients, and at the same time it forms the main protective barrier between the sterile environment of the body and the outside world. In mammals, the intestine has further evolved to harbor a vast load of commensal bacteria that have important functions for the host. Discrimination by the host defense system of nonself from self can prevent invasion of pathogens, but equivalent responses to dietary or colonizing bacteria can lead to devastating consequences for the organism. This dilemma imposed by the gut environment has probably contributed significantly to the evolutionary drive that has led to sophisticated mechanisms and diversification of the immune system to allow for protection while maintaining the integrity of the mucosal barrier. The immense expansion and specialization of the immune system is particularly mirrored in the phylogeny, ontogeny, organization, and regulation of the adaptive intraepithelial lymphocytes, or IEL, which are key players in the unique intestinal defense mechanisms that have evolved in mammals.