The M17 aminopeptidase from the carcinogenic gastric bacterium Helicobacter pylori (HpM17AP) is an important housekeeping enzyme involved in catabolism of endogenous and exogenous peptides. It is implicated in H. pylori defence against the human innate immune response and in the mechanism of metronidazole resistance. Bestatin inhibits HpM17AP and suppresses H. pylori growth. To address the structural basis of catalysis and inhibition of this enzyme, we have established its specificity towards the N-terminal amino acid of peptide substrates and determined the crystal structures of HpM17AP and its complex with bestatin. The position of the D-phenylalanine moiety of the inhibitor with respect to the active-site metal ions, bicarbonate ion and with respect to other M17 aminopeptidases suggested that this residue binds to the S1 subsite of HpM17AP. In contrast to most characterized M17 aminopeptidases, HpM17AP displays preference for L-Arg over L-Leu residues in peptide substrates. Compared to very similar homologues from other bacteria, a distinguishing feature of HpM17AP is a hydrophilic pocket at the end of the S1 subsite that is likely to accommodate the charged head group of the L-Arg residue of the substrate. The pocket is flanked by a sodium ion (not present in M17 aminopeptidases that show preference for L-Leu) and its coordinating water molecules. In addition, the structure suggests that variable loops at the entrance to, and in the middle of, the substrate-binding channel are important determinants of substrate specificity of M17 aminopeptidases.