The engrailed gene is well known from its role in segmentation and central nervous system development in a variety of species. In molluscs, however, engrailed is involved in shell formation. So far, it seemed that engrailed had been co-opted uniquely for this particular process in molluscs. Here, we show that, in the gastropod mollusc Patella vulgata, an engrailed ortholog is expressed in the edge of the embryonic shell and in the anlage of the apical sensory organ. Surprisingly, a dpp-BMP2/4 ortholog is expressed in cells of the ectoderm surrounding, but not overlapping, the engrailed-expressing shell-forming cells. It is also expressed in the anlage of the eyes. Earlier it was shown that a compartment boundary exists between the cells of the embryonic shell and the adjacent ectoderm. We conclude that engrailed and dpp are most likely involved in setting up a compartment boundary between these cells, very similar to the situation in, for example, the developing wing imaginal disc in Drosophila. We suggest that engrailed became involved in shell formation because of its ancestral role, which is to set up compartment boundaries between embryonic domains.