The association of ERAP1 with ankylosing spondylitis (AS)1 among HLA-B27-positive individuals suggests that ERAP1 polymorphism may affect pathogenesis by altering peptide-dependent features of the HLA-B27 molecule. Comparisons of HLA-B*27:04-bound peptidomes from cells expressing different natural variants of ERAP1 revealed significant differences in the size, length, and amount of many ligands, as well as in HLA-B27 stability. Peptide analyses suggested that the mechanism of ERAP1/HLA-B27 interaction is a variant-dependent alteration in the balance between epitope generation and destruction determined by the susceptibility of N-terminal flanking and P1 residues to trimming. ERAP1 polymorphism associated with AS susceptibility ensured efficient peptide trimming and high HLA-B27 stability. Protective polymorphism resulted in diminished ERAP1 activity, less efficient trimming, suboptimal HLA-B27 peptidomes, and decreased molecular stability. This study demonstrates that natural ERAP1 polymorphism affects HLA-B27 antigen presentation and stability in vivo and proposes a mechanism for the interaction between these molecules in AS.