Cell sorting involves the segregation of two cell populations into `immiscible' adjacent tissues with smooth borders. Echinoid (Ed), a nectin ortholog, is an adherens junction protein in Drosophila, and cells mutant for ed sort out from the surrounding wild-type cells. However, it remains unknown which factors trigger cell sorting. Here, we dissect the sequence of this process and find that cell sorting occurs when differential expression of Ed triggers the assembly of actomyosin cable. Conversely, Ed-mediated cell sorting can be rescued by recruitment of Ed, via homophilic or heterophilic interactions, to the wild-type cell side of the clonal interface, even when differential Ed expression persists. We found, unexpectedly, that when actomyosin cable was largely absent, differential adhesion was sufficient to cause limited cell segregation but with a jagged tissue border (imperfect sorting). We propose that Ed-mediated cell sorting is driven both by differential Ed adhesion that induces cell segregation with a jagged border and by actomyosin cable assembly at the interface that smoothens this border.