The microbial communities that colonize living organisms are collectively referred to as the 'microbiota'. These resident commensals are well adapted to the ecological conditions of their host and constitute a complex ecosystem in which host-microbe, environment-microbe and microbe-microbe interactions dictate the composition and dynamics of the community. As with every ecosystem, commensal species occupy a niche, are evolutionarily adapted and continuously selected by the environmental pressures in the niche, and compete with other species for niche resources. In mammals, the gut microbiota has coevolved to provide essential functions for host physiological processes, such as the acquisition of nutrients, the development and maturation of the immune system and enhancement of the intestinal barrier. In this issue of Nature Immunology, we provide a series of specially commissioned articles to discuss recent advances on the understanding of the complex relationship between the microbiota and the host immune system (http://www.nature.com/ni/focus/microbiota).

The gastrointestinal tract contains the most abundant commensal community in mammals. However, other anatomical sites are colonized by unique communities of bacteria, with their structure and composition determined by their unique environment. In their Perspective, Belkaid and Naik review the present understanding of the physiological impact of resident commensals in the skin as well as the oral, vaginal and airway mucosa. In contrast to the dominant role of the gut microbiota, which can control the development of the immune system and set systemic thresholds for immune activation, the microbiota at sites other than the gut has a more local and discrete influence on processes such as tissue homeostasis, immune responses and tissue repair.

Whereas recent efforts have generated a wealth of information on the composition of host-associated bacterial communities, much less is known about the viruses that colonize healthy people (the so-called 'virobiota') or the effect of viral genes (the 'virome') on host immunity. Study of the virobiota is an emerging field, and understanding of virobiota–immune system interactions is very preliminary. In their Perspective, Duerkop and Hooper provide a framework for considering how resident viruses associated with either the bacterial commensals (phages) or the host cells can shape microbiota communities and influence host immunity.

Four commissioned Reviews discuss the complex interactions between the gut microbiota and the immune system. Despite the beneficial aspects of microbial colonization of the intestine, the abundance and proximity of such microbes to the host epithelium poses a major challenge to host integrity. Finlay and colleagues review the strategies used by the immune system to confine the microbial community in the lumen of the intestinal tract and achieve homeostasis. These include physical and biochemical barriers (the mucus layer, secretion of antimicrobial peptides and immunoglobulin A), as well as continuous surveillance by cellular and molecular components of the innate and adaptive immune system. This Review also discusses how environmental triggers, such as dietary changes, gastrointestinal pathogens or antibiotic treatment, or host-related factors, such as genetic susceptibility or immunodeficiency, can lead to a breakdown in host-microbe mutualism.

Chu and Mazmanian cover recent research on the symbiotic relationship between invertebrate or vertebrate hosts and their bacterial communities and suggest that pattern-recognition receptors may have evolved to mediate the bidirectional cross-talk between microbial symbionts and their hosts. From Hydra to humans, these authors provide examples that highlight the role of these receptors in mediating the recognition of commensals and shaping the composition of microbiota, as well as in inducing tolerance toward symbiotic bacteria through local and systemic responses.

Finally, two Reviews discuss how various aspects of microbiota activity can influence host metabolism and immune function. Commensal bacteria regulate the production and bioavailability of diet-dependent nutrients and metabolites such as bile acids, short-chain fatty acids and vitamins. Brestoff and Artis discuss how such commensal-derived products modulate the development and function of the immune system in health and disease. The commensal microbiota also protects against colonization by pathogens. Nuñez and colleagues highlight several mechanisms by which such interactions take place, such as competitive metabolic interactions and colonization of intestinal niches.

A question central to understanding the complex interactions between host and microbiota is how the immune system distinguishes between commensals and pathogens. All bacteria, tolerated or not, share the same molecular patterns and are sensed by the same recognition pathways and receptors. The common opinion presented in this Focus is that recognition of pathogens versus commensals is not 'hard-wired' in the host immune system. The process is instead one of education. Hosts learn to recognize, restrain and tolerate their bacterial commensals. Through birth, breastfeeding and social interactions, mammals inherit a preselected community of microbes that is able to integrate into the physiological and homeostatic requirements of its host. Both the microbiota and the host use tools and signals shaped by millions of years of coevolution to maintain a constant dialog and a mutualistic relationship. As with any relationship, things can go wrong. Small imbalances introduced by the host's genetic makeup and/or various triggers, such as recurrent immune responses or microbial dysbiosis, can over time disturb the dynamic equilibrium between host and commensals. In such circumstances, the microbiota can become an amplifier of pathological effects and can feed forward into deregulated pathways that lead to local or systemic disease. As this exciting area of research blossoms, it becomes more and more apparent that studies of the immune system during homeostasis or disease cannot ignore the microbial world within.