A typical protein antigen contains several epitopes that can be recognized by cytotoxic T lymphocytes (CTL), but in a characteristic antiviral immune response in vivo, CTL recognize only a small number of these potential epitopes, sometimes only one, this phenomenon is known as immunodominance. Antigenic variation within CTL epitopes has been demonstrated for the human immunodeficiency virus HIV-1 (ref. 11) and other viruses and such 'antigenic escape' may be responsible for viral persistence. Here we develop a new mathematical model that deals with the interaction between CTL and multiple epitopes of a genetically variable pathogen, and show that the nonlinear competition among CTL responses against different epitopes can explain immunodominance. This model suggests that an antigenically homogeneous pathogen population tends to induce a dominant response against a single epitope, whereas a heterogeneous pathogen population can stimulate complicated fluctuating responses against multiple epitopes. Antigenic variation in the immunodominant epitope can shift responses to weaker epitopes and thereby reduce immunological control of the pathogen population. These ideas are consistent with detailed longitudinal studies of CTL responses in HIV-1 infected patients. For vaccine design, the model suggests that the major response should be directed against conserved epitopes even if they are subdominant.