The phylogeographic population structure of Mycobacterium tuberculosis suggests local adaptation to sympatric human populations. We hypothesized that HIV infection, which induces immunodeficiency, will alter the sympatric relationship between M. tuberculosis and its human host. To test this hypothesis, we performed a nine-year nation-wide molecular-epidemiological study of HIV-infected and HIV-negative patients with tuberculosis (TB) between 2000 and 2008 in Switzerland. We analyzed 518 TB patients of whom 112 (21.6%) were HIV-infected and 233 (45.0%) were born in Europe. We found that among European-born TB patients, recent transmission was more likely to occur in sympatric compared to allopatric host-pathogen combinations (adjusted odds ratio [OR] 7.5, 95% confidence interval [95% CI] 1.21-infinity, p = 0.03). HIV infection was significantly associated with TB caused by an allopatric (as opposed to sympatric) M. tuberculosis lineage (OR 7.0, 95% CI 2.5-19.1, p<0.0001). This association remained when adjusting for frequent travelling, contact with foreigners, age, sex, and country of birth (adjusted OR 5.6, 95% CI 1.5-20.8, p = 0.01). Moreover, it became stronger with greater immunosuppression as defined by CD4 T-cell depletion and was not the result of increased social mixing in HIV-infected patients. Our observation was replicated in a second independent panel of 440 M. tuberculosis strains collected during a population-based study in the Canton of Bern between 1991 and 2011. In summary, these findings support a model for TB in which the stable relationship between the human host and its locally adapted M. tuberculosis is disrupted by HIV infection.