RESUMO
Sexually dimorphic behaviours require underlying differences in the nervous system between males and females. The extent to which nervous systems are sexually dimorphic and the cellular and molecular mechanisms that regulate these differences are only beginning to be understood. We reveal here a novel mechanism by which male-specific neurons are generated in Caenorhabditis elegans through the direct transdifferentiation of sex-shared glial cells. This glia-to-neuron cell fate switch occurs during male sexual maturation under the cell-autonomous control of the sex-determination pathway. We show that the neurons generated are cholinergic, peptidergic, and ciliated putative proprioceptors which integrate into male-specific circuits for copulation. These neurons ensure coordinated backward movement along the mate's body during mating. One step of the mating sequence regulated by these neurons is an alternative readjustment movement performed when intromission becomes difficult to achieve. Our findings reveal programmed transdifferentiation as a developmental mechanism underlying flexibility in innate behaviour.