At mucosal surfaces, the immune system should not initiate inflammatory immune responses to the plethora of antigens constantly present in the environment, but should remain poised to unleash a potent assault on intestinal pathogens. The transcriptional programs and regulatory factors required for immune cells to switch from homeostatic (often tissue-protective) function to potent antimicrobial immunity are poorly defined. Mucosal retinoic-acid-receptor-related orphan receptor-γt-positive (RORγt(+)) innate lymphoid cells (ILCs) are emerging as an important innate lymphocyte population required for immunity to intestinal infections. Various subsets of RORγt(+) ILCs have been described but the transcriptional programs controlling their specification and fate remain largely unknown. Here we provide evidence that the transcription factor T-bet determines the fate of a distinct lineage of CCR6(-)RORγt(+) ILCs. Postnatally emerging CCR6(-)RORγt(+) ILCs upregulated T-bet and this was controlled by cues from the commensal microbiota and interleukin-23 (IL-23). In contrast, CCR6(+)RORγt(+) ILCs, which arise earlier during ontogeny, did not express T-bet. T-bet instructed the expression of T-bet target genes such as interferon-γ (IFN-γ) and of the natural cytotoxicity receptor NKp46. Mice genetically lacking T-bet showed normal development of CCR6(-)RORγt(+) ILCs, but they could not differentiate into NKp46-expressing RORγt(+) ILCs (that is, IL-22-producing natural killer (NK-22) cells) and failed to produce IFN-γ. The production of IFN-γ by T-bet-expressing CCR6(-)RORγt(+) ILCs was essential for the release of mucus-forming glycoproteins required to protect the epithelial barrier during Salmonella enterica infection. Salmonella infection also causes severe enterocolitis that is at least partly driven by IFN-γ. Mice deficient for T-bet or depleted of ILCs developed only mild enterocolitis. Thus, graded expression of T-bet in CCR6(-)RORγt(+) ILCs facilitates the differentiation of IFN-γ-producing CCR6(-)RORγt(+) ILCs required to protect the epithelial barrier against Salmonella infections. Co-expression of T-bet and RORγt, which is also found in subsets of IL-17-producing T-helper (T(H)17) cells, may be an evolutionarily conserved transcriptional program that originally developed as part of the innate defence against infections but that also confers an increased risk of immune-mediated pathology.