The evolution of arthropod segmentation has been studied by comparing expression patterns of pair-rule and segment polarity genes in various species. In Drosophila, the formation and maintenance of the parasegmental boundaries depend on the interactions between the wingless (wg), engrailed (en) and hedgehog (hh) genes. Until now, the expression pattern of hh has not been analysed to such a great extent as en or wg. We report the cloning and expression analysis of hh genes from Euscorpius flavicaudis, a chelicerate, and Artemia franciscana, a branchiopod crustacean. Our data provide evidence that hh, being expressed in the posterior part of every segment, is a segment polarity gene in both organisms. Additional hh expression sites were observed in the rostrum and appendages of Euscorpius and in the gut of Artemia. From the available data on hh expression in various bilaterians, we review the various hypotheses on the evolution of hh function and we suggest an ancestral role of hh in proctodeum specification and gut formation.