Sex-determining cascades are supposed to have evolved in a retrograde manner from bottom to top. Wilkins' 1995 hypothesis finds support from our comparative studies in Drosophila melanogaster and Musca domestica, two dipteran species that separated some 120million years ago. The sex-determining cascades in these flies differ at the level of the primary sex-determining signal and their targets, Sxl in Drosophila and F in Musca. Here we present evidence that they converge at the level of the terminal regulator, doublesex (dsx), which conveys the selected sexual fate to the differentiation genes. The dsx homologue in Musca, Md-dsx, encodes male-specific (MdDSXM) and female-specific (MdDSXF) protein variants which correspond in structure to those in Drosophila. Sex-specific regulation of Md-dsx is controlled by the switch gene F via a splicing mechanism that is similar but in some relevant aspects different from that in Drosophila. MdDSXF expression can activate the vitellogenin genes in Drosophila and Musca males, and MdDSXM expression in Drosophila females can cause male-like pigmentation of posterior tergites, suggesting that these Musca dsx variants are conserved not only in structure but also in function. Furthermore, downregulation of Md-dsx activity in Musca by injecting dsRNA into embryos leads to intersexual differentiation of the gonads. These results strongly support a role of Md-dsx as the final regulatory gene in the sex-determining hierarchy of the housefl