Bacterial pathogens synthesize numerous proteins that are either secreted or localized within bacterial cells. To address the impact of antigen compartmentalization on T cell immunity, we constructed recombinant Listeria monocytogenes that express a model CD8T cell epitope as a secreted or nonsecreted fusion protein. Both forms of the antigen, either secreted into the host cell cytoplasm or retained within bacterial cells, efficiently prime CD8 T cell responses. However, epitope-specific CD8 T cells confer protection only against bacteria secreting the antigen but not against the bacteria expressing the nonsecreted form of the same antigen. This dichotomy as a result of antigen compartmentalization suggests that bacterial antigens are presented by multiple MHC class I pathways to prime CD8 T cells, but only the endogenous pathway provides target antigens for CD8 T cell-mediated protective immunity.