Aims: To determine risk factors for active tuberculosis in patients with inflammatory bowel diseases.Methods: Retrospective, case-control study at 4 referral hospitals in Spain. Cases developed tuberculosis after a diagnosis of inflammatory bowel disease. Controls were inflammatory bowel disease patients who did not develop tuberculosis. For each case, we randomly selected 3 controls matched for sex, age (within 5 years) and time of inflammatory bowel disease diagnosis (within 3 years). Inflammatory bowel disease characteristics, candidate risk factors for tuberculosis and information about the tuberculosis episode were recorded. Multivariate analysis and a Chi-squared automatic interaction detector were used.Results: Thirty-four cases and 102 controls were included. Nine of the 34 cases developed active tuberculosis between 1989 and 1999, and 25 became ill between 2000 and 2012. Multivariate regression showed an association between active tuberculosis and anti-TNF (tumor necrosis factor) therapy in the previous 12 months (OR 7.45; 95% CI, 2.39-23.12; p = 0.001); hospitalization in the previous 6 months (OR 4.38; 95% CI, 1.18-16.20; p = 0.027); and albumin levels (OR 0.88; 95% CI, 0.81-0.95; p = 0.001). The median time between the start of biologic therapy and the onset of active tuberculosis was 13 (interquartile range, 1-58) months. Tuberculosis developed after a year of anti-TNF therapy in 53%, and late reactivation occurred in at least 3 of 8 patients.Conclusions: The main risks factors for developing tuberculosis were anti-TNF therapy and hospitalization. Over half the cases related to anti-TNF treatment occurred after a year.