Gut microbial community properties of mammals are thought to be partly shaped by a combination of host immunity and environmental factors, but their relative importance is not firmly established. To address this gap, we first characterized the faecal bacteria of mice with a functioning immune system (wild-type, WT), mice with defective immune responses (CD45), mice lacking an adaptive immune system (RAG), and mice with both immune dysfunctions (45RAG). Using fingerprinting of 16S rRNA genes, we observed significant differences in gut microbiota composition across all mouse strains (P< 0.001) and identified several mouse strain-specific genera via pyrosequencing, includingTuricibactersp. (in WT mice) andAllobaculumsp. (in CD45-deficient animals). To define the role of the host immune system in constraining gut microbiota stability after perturbation, we cohoused CD45-deficient and WT mice and monitored gut bacterial community dynamics during 8 weeks. Cohousing caused the WT bacterial communities to become indistinguishable from those of CD45 mice (P> 0.05). Time-series analysis indicated that the communities of cohoused mice changed directionally as opposed to the relatively stable communities of non-cohoused controls. When we considered only taxonomic membership, it was the communities of CD45 non-cohoused mice that experienced the highest rate of change. Rather than be governed by fluctuations in the relative abundance of taxa, we suggest that CD45-regulated immune responses either are stimulated by the presence of bacteriaper seor promote temporal stability by selecting for the occurrence of specific taxa.