Cytotoxic T lymphocyte (CTL) and natural killer (NK) cell responses to a single optimal 10-mer epitope (KK10) in the human immunodeficiency virus type-1 (HIV-1) protein p24Gag are associated with enhanced immune control in patients expressing human leukocyte antigen (HLA)-B∗27:05. We find that proteasomal activity generates multiple length variants of KK10 (4–14 amino acids), which bind TAP and HLA-B∗27:05. However, only epitope forms ≥8 amino acids evoke peptide length-specific and cross-reactive CTL responses. Structural analyses reveal that all epitope forms bind HLA-B∗27:05 via a conserved N-terminal motif, and competition experiments show that the truncated epitope forms outcompete immunogenic epitope forms for binding to HLA-B∗27:05. Common viral escape mutations abolish (L136M) or impair (R132K) production of KK10 and longer epitope forms. Peptide length influences how well the inhibitory NK cell receptor KIR3DL1 binds HLA-B∗27:05 peptide complexes and how intraepitope mutations affect this interaction. These results identify a viral escape mechanism from CTL and NK responses based on differential antigen processing and peptide competition.