In a Drosophila follicle the oocyte always occupies a posterior position among a group of sixteen germline cells. Although the importance of this cell arrangement for the subsequent formation of the anterior-posterior axis of the embryo is well documented, the molecular mechanism responsible for the posterior localization of the oocyte was unknown. Here we show that the homophilic adhesion molecule DE-cadherin mediates oocyte positioning. During follicle biogenesis, DE-cadherin is expressed in germline (including oocyte) and surrounding follicle cells, with the highest concentration of DE-cadherin being found at the interface between oocyte and posterior follicle cells. Mosaic analysis shows that DE-cadherin is required in both germline and follicle cells for correct oocyte localization, indicating that germline-soma interactions may be involved in this process. By analysing the behaviour of the oocyte in follicles with a chimaeric follicular epithelium, we find that the position of the oocyte is determined by the position of DE-cadherin-expressing follicle cells, to which the oocyte attaches itself selectively. Among the DE-cadherin positive follicle cells, the oocyte preferentially contacts those cells that express higher levels of DE-cadherin. On the basis of these data, we propose that in wild-type follicles the oocyte competes successfully with its sister germline cells for contact to the posterior follicle cells, a sorting process driven by different concentrations of DE-cadherin. This is, to our knowledge, the first in vivo example of a cell-sorting process that depends on differential adhesion mediated by a cadherin.