Background: Whether aminosalicylates or thiopurines reduce the risk of colorectal cancer (CRC) in inflammatory bowel (IBD) disease is controversial. Aim: To assess simultaneously the chemopreventive effect of aminosalicylates or thiopurines in a case–control study nested in the CESAME observational cohort that enrolled consecutive patients with IBD between May 2004 and June 2005. Patients were followed up to December 2007. Methods: Study population comprised 144 case patients who developed CRC from the diagnosis of IBD (65 and 79 cases diagnosed, respectively, before and from 2004, starting year of the prospective observational period of CESAME) and 286 controls matched for gender, age, IBD subtype and year of diagnosis, and cumulative extent of colitis. Exposure to aminosalicylates or thiopurines was defined by an exposure to the treatment during the year of the diagnosis of cancer. The propensity of receiving 5-ASA and thiopurines was quantified by a composite score taking into account patient and IBD characteristics. The role of aminosalicylates or thiopurines was assessed by multivariate analysis. Propensity scores and the history of primary sclerosing cholangitis were entered into the multivariate model for adjustment. Results: By multivariate analysis adjusted for propensity, a significant protective effect of exposure to drugs during the year of cancer was found for aminosalicylates (OR = 0.587, 95% CI: 0.367–0.937, P = 0.0257), but not for thiopurines (OR = 0.762, 95% CI: 0.432–1.343, P = 0.3468). Conclusion: In a case–control study nested in the CESAME cohort, a significant decrease in the risk of colorectal cancer in IBD was associated with exposure to aminosalicylates, not to thiopurines.