At the present time, there is little information on mechanisms of innate immunity in invertebrate groups other than insects, especially annelids. In the present study, we have performed a transcriptomic study of the immune response in the leech Theromyzon tessulatum after bacterial challenge, by a combination of differential display RT (reverse transcriptase)-PCR and cDNA microarrays. The results show relevant modulations concerning several known and unknown genes. Indeed, threonine deaminase, malate dehydrogenase, cystatin B, polyadenylate-binding protein and alpha-tubulin-like genes are up-regulated after immunostimulation. We focused on cystatin B (stefin B), which is an inhibitor of cysteine proteinases involved in the vertebrate immune response. We have cloned the full-length cDNA and named the T. tessulatum gene as Tt-cysb. Main structural features of cystatins were identified in the derived amino acid sequence of Tt-cysb cDNA; namely, a glycine residue in the N-terminus and a consensus sequence of Gln-Xaa-Val-Xaa-Gly (QXVXG) corresponding to the catalytic site. Moreover, Tt-cysb is the first cystatin B gene characterized in invertebrates. We have determined by in situ hybridization and immunocytochemistry that Tt-cysb is only expressed in large coelomic cells. In addition, this analysis confirmed that Tt-cysb is up-regulated after bacterial challenge, and that increased expression occurs only in coelomic cells. These data demonstrate that the innate immune response in the leech involves a cysteine proteinase inhibitor that is not found in ecdysozoan models, such as Drosophila melanogaster or Caenorhabditis elegans, and so underlines the great need for information about innate immunity mechanisms in different invertebrate groups.