Much of our knowledge on hematopoiesis, hematopoietic compartments, hematopoietic cell lineages and immunity has been derived from studies on the vertebrate immune system. The sophisticated innate immunity of insects, the phylogenetic conservation and the power of Drosophila genetics allowed the investigation of immune cell (hemocyte) lineage relationships in Drosophila melanogaster. The development of the hemocyte lineages in Drosophila is a result of a precisely regulated succession of intracellular and intercellular events, though the nature and extent of these interactions are not known. We describe here a cell lineage tracing system set up to analyze the development of hemocyte lineages and functionally distinct hemocyte subsets. This system allowed us to distinguish two major embryonic hemocyte lineages, the crq and Dot lineages, in two, physically separated compartments, the embryonic macrophages and the embryonic lymph gland. We followed the fate and development of these lineages in the construction of the larval hematopoietic compartments and during the cell-mediated immune response, the encapsulation reaction. Our results revealed the considerable plasticity and concerted action of the hematopoietic compartments and the hemocyte lineages in the development of the innate immune system and in the course of the cell-mediated immune response in Drosophila.