In the Drosophila gut, reactive oxygen species (ROS)-dependent immunity is critical to host survival. This is in contrast to the NF-kappaB pathway whose physiological function in the microbe-laden epithelia has yet to be convincingly demonstrated despite playing a critical role during systemic infections. We used a novel in vivo approach to reveal the physiological role of gut NF-kappaB/antimicrobial peptide (AMP) system, which has been 'masked' in the presence of the dominant intestinal ROS-dependent immunity. When fed with ROS-resistant microbes, NF-kappaB pathway mutant flies, but not wild-type flies, become highly susceptible to gut infection. This high lethality can be significantly reduced by either re-introducing Relish expression to Relish mutants or by constitutively expressing a single AMP to the NF-kappaB pathway mutants in the intestine. These results imply that the local 'NF-kappaB/AMP' system acts as an essential 'fail-safe' system, complementary to the ROS-dependent gut immunity, during gut infection with ROS-resistant pathogens. This system provides the Drosophila gut immunity the versatility necessary to manage sporadic invasion of virulent pathogens that somehow counteract or evade the ROS-dependent immunity.