['Habitat selection may have profound evolutionary consequences, but they strongly depend on the underlying preference mechanism, including genetically-determined, natal habitat and phenotype-dependent preferences. It is known that different mechanisms may operate at the same time, yet their relative contribution to population differentiation remains largely unexplored empirically mainly because of the difficulty of finding suitable study systems. Here, we investigate the role of early experience and genetic background in determining the outcome of settlement by pied flycatchers (Ficedula hypoleuca) breeding in two habitat patches between which dispersal and subsequent reproductive performance is influenced by phenotype (body size). For this, we conducted a cross-fostering experiment in a two-patch system: an oakwood and a conifer plantation separated by only 1\xa0km.', "Experimental birds mostly returned to breed in the forest patch where they were raised, whether it was that of their genetic or their foster parents, indicating that decisions on where to settle are determined by individuals' experience in their natal site, rather than by their genetic background. Nevertheless, nearly a third (27.6\xa0%) moved away from the rearing habitat and, as previously observed in unmanipulated individuals, dispersal between habitats was phenotype-dependent. Pied flycatchers breeding in the oak and the pine forests are differentiated by body size, and analyses of genetic variation at microsatellite loci now provide evidence of subtle genetic differentiation between the two populations. This suggests that phenotype-dependent dispersal may contribute to population structure despite the short distance and widespread exchange of birds between the study plots."] Does natal habitat imprinting counteract the diversifying effects of phenotype-dependent dispersal in a spatially structured population?