Studies on Drosophila immunity have focused on the humoral response, whereas less is known about the Drosophila cellular immunity. Here we show that mutants that lack the Drosophila Rel/NF-kappaB proteins Dorsal and Dif have very few blood cells, are constitutively infected by opportunistic microbes, and die from infection as larvae. When the double mutants are grown in microbe-free conditions, the animals are rescued from chronic infection and many survive to adult stages. Thus, Dif and Dorsal are required for survival because they protect the animal from infection by microbes from the environment. Specific expression of Dif or dorsal in the blood cell lineage is sufficient to restore blood cell number, clear microbes, and allow survival to the adult stage. These findings demonstrate that the cellular immune response is essential for the ability of Drosophila to survive in their standard laboratory environment, and that Dif and Dorsal control crucial aspects of the cellular immune response, including blood cell survival and the ability to fight off microbial infection.