Molecular mimicry is discussed as a possible mechanism that may contribute to the development of autoimmune diseases. It could also be involved in the differential association of the human major histocompatibility subtypes HLA-B*2705 and HLA-B*2709 with ankylosing spondylitis. These two subtypes differ only in residue 116 of the heavy chain (Asp in B*2705 and His in B*2709), but the reason for the differential disease association is not understood. Using x-ray crystallography, we show here that the viral peptide pLMP2 (RRRWRRLTV, derived from latent membrane protein 2 (residues 236 -244) of Epstein-Barr virus) is presented by the B*2705 and B*2709 molecules in two drastically deviating conformations. Extensive structural similarity between pLMP2 and the self-peptide pVIPR (RRKWRRWHL, derived from vasoactive intestinal peptide type 1 receptor (residues 400 -408)) is observed only when the peptides are presented by B*2705 because of a salt bridge between Arg 5 of both peptides and the subtype-specific heavy chain residue Asp 116 . Combined with functional studies using pLMP2/pVIPR-cross-reactive cytotoxic T cell lines and clones, together with target cells presenting these peptides or a modified peptide analogue, our results reveal that a pathogen-derived peptide can exhibit major histocompatibility complex class I subtypedependent, drastically distinct binding modes. Furthermore, the results demonstrate that molecular mimicry between pLMP2 and pVIPR in the HLA-B27 context is an allele-dependent property.