The homeobox gene caudal (cad) has a maternal embryonic function that establishes the antero-posterior body axis of Drosophila. It also has a conserved late embryonic and imaginal function related to the development of the posterior body region. Here we report the developmental role of cad in adult Drosophila. It is required for the normal development of the analia structures, which derive from the most posterior body segment. In the absence of cad function, the analia develop like the immediately anterior segment (male genitalia), following the transformation rule of the canonical Hox genes. We also show that cad can induce ectopic analia development if expressed in the head or wing. We propose that cad is the Hox gene that determines the development of the fly's most posterior segment. cad acts in combination with the Hedgehog (Hh) pathway to specify the different components of the analia: the activities of cad and of the Hh pathway induce Distal-less expression that, together with cad, promote external analia development. In the absence of the Hh pathway, cad induces internal analia development, probably by activating the brachyenteron and even-skipped genes.