In Drosophila, each segmental primordium is subdivided into two cell populations, the anterior (A) and posterior (P) compartments by the selective activity of the transcription factor Engrailed (En) in P cells. Under En control, P cells secrete, but cannot respond to, the signalling protein Hedgehog (Hh). In contrast, and by default, A cells are programmed to respond to Hh by expressing other signalling molecules, such as Decapentaplegic (Dpp) and Wingless (Wg), which organize growth and patterning in both compartments. Cells of the A and P compartments do not intermix, apparently as a consequence of their having distinct cell affinities that cause them to maximize contact with cells of the same compartment, while minimizing contact with cells from the other compartment. This failure to mix has previously been ascribed to an autonomous and direct role for En in specifying a P, as opposed to an A, cell affinity. However, an alternative hypothesis is that Hh secreted by P cells induces A cells to acquire a distinct cell affinity, ensuring that a stable 'affinity boundary' forms wherever P and A cells meet. Here we show that the affinity boundary that segregates A and P cells into adjacent but immiscible cell populations is to a large extent a consequence of local Hh signalling, rather than a reflection of an intrinsic affinity difference between A and P cells.