The wing imaginal disc is subdivided into two nonintermingling sets of cells, the anterior (A) and posterior (P) compartments. Anterior cells require reception of the Hedgehog (Hh) signal to segregate from P cells. We provide evidence that Hh signaling controls A/P cell segregation not by directly modifying structural components but by a Cubitus interruptus (Ci)-mediated transcriptional response. A shift in the balance between repressor and activator forms of Ci toward the activator form is necessary and sufficient to define "A-type" cell sorting behavior. Moreover, we show that Engrailed (En), in the absence of Ci, is sufficient to specify "P-type" sorting. We propose that the opposing transcriptional activities of Ci and En control cell segregation at the A/P boundary by regulating a single cell adhesion molecule.