Endoplasmic reticulum aminopeptidases ERAP1/2 have emerged in the last years as key enzymes for the production of antigenic peptides that are presented by MHC class I molecules at the cell surface as part of the adaptive immune response. ERAP1 has unusual enzymatic properties that make it particularly suitable for this biological function. Specifically, it efficiently degrades peptides longer than 9 residues and shows preferences for the whole substrate sequence and not only for the N-terminus. Recently, coding Single Nucleotide Polymorphisms (SNPs) in ERAP1/2 were associated with predisposition to autoimmune diseases, such as ankylosing spondylitis, with cancer and with resistance to HIV infection. The hypothesis of this thesis is that the particular molecular mechanism of action of ERAP1/2 and the way in which this mechanism is affected by coding polymorphisms is the underlying reason for the association of ERAP1/2 with predisposition to human disease. To verify this hypothesis we investigated the molecular mechanism of action of ERAP1/2 aminopeptidases in the context of their polymorphic variability. We first developed a novel fluorigenic assay to analyze the activity of these enzymes. Biochemical analysis in combination with the recently solved ERAP1 crystal structure allowed us to propose a molecular model of function that can account for both substrate length and sequence specificity. In parallel, we set the groundwork for the development of small molecular weight compounds that modulate ERAP1 activity, by scanning a chemical library of pharmaceuticals and discovering lead compounds that either act as inhibitors or as activators of the enzyme.In order to understand the association of ERAP1/2 polymorphicity with changes in antigen presentation, we expressed different ERAP1/2 alleles and studied their ability to degrade different antigenic epitope precursors. Michaelis-Menten analysis showed that specific SNPs in ERAP1 affect the ΚΜ and kcat parameters of the enzyme and that particular allele-substrate combinations demonstrate substrate inhibition kinetics. A common ERAP2 allele was found to have a stronger effect on enzyme function and, as ERAP1 alleles, not only affects enzymatic activity but also alters specificity. The above results support the hypothesis that genetic variability in ERAP1/2 aminopeptidases can affect the generation of antigenic epitopes and may represent a previously unrecognized facet of adaptive immune response variability.