In vertebrates (deuterostomes), brain patterning depends on signals from adjacent tissues. For example, holoprosencephaly, the most common brain anomaly in humans, results from defects in signaling between the embryonic prechordal plate (consisting of the dorsal foregut endoderm and mesoderm) and the brain. I have examined whether a similar mechanism of brain development occurs in the protostome Drosophila, and find that the foregut and mesoderm act to pattern the fly embryonic brain. When the foregut and mesoderm of Drosophila are ablated, brain patterning is disrupted. The loss of Hedgehog expressed in the foregut appears to mediate this effect, as it does in vertebrates. One mechanism whereby these defects occur is a disruption of normal apoptosis in the brain. These data argue that the last common ancestor of protostomes and deuterostomes had a prototype of the brains present in modern animals, and also suggest that the foregut and mesoderm contributed to the patterning of this 'proto-brain'. They also argue that the foreguts of protostomes and deuterostomes, which have traditionally been assigned to different germ layers, are actually homologous.