Whereas many antibiotics increase risk of Clostridium difficile infection through dysbiosis, epidemic C difficile ribotypes characterised by multidrug resistance might depend on antibiotic selection pressures arising from population use of specific drugs. We examined the effect of a national antibiotic stewardship intervention limiting the use of 4C antibiotics (fluoroquinolones, clindamycin, co-amoxiclav, and cephalosporins) and other infection prevention and control strategies on the clinical and molecular epidemiology of C difficile infections in northeast Scotland. We did a non-linear time-series analysis and quasi-experimental study to explore ecological determinants of clinical burdens from C difficile infections and ribotype distributions in a health board serving 11% of the Scottish population. Study populations were adults (aged ≥16 years) registered with primary carer providers in the community (mean 455 508 inhabitants) or admitted to tertiary level, district general, or geriatric hospitals (mean 33 049 total admissions per month). A mixed persuasive-restrictive 4C antibiotic stewardship intervention was initiated in all populations on May 1, 2009. Other population-specific interventions considered included limiting indications for macrolide prescriptions, introduction of alcohol-based hand sanitiser, a national hand-hygiene campaign, national auditing and inspections of hospital environment cleanliness, and reminders to reduce inappropriate use of proton-pump inhibitors. The total effect of interventions was defined as the difference between observations and projected scenarios without intervention. Primary outcomes were prevalence density of C difficile infection per 1000 occupied bed-days in hospitals or per 100 000 inhabitant-days in the community. Between Jan 1, 1997, and Dec 31, 2012, we identified 4885 cases of hospital-onset C difficile infection among 1 289 929 admissions to study hospitals, and a further 1625 cases of community-onset C difficile infection among 455 508 adults registered in primary care. Use of 4C antibiotics was reduced by 50% in both hospitals (mean reduction 193 defined daily doses per 1000 occupied bed-days, 95% CI 45-328, p=0·008) and the community (1·85 defined daily doses per 1000 inhabitant-days, 95% CI 0·23-3·48, p=0·025) during antibiotic stewardship. Falling 4C use predicted rapid declines in multidrug-resistant ribotypes R001 and R027. Hospital-onset C difficile infection prevalence densities were associated with fluoroquinolone, third-generation cephalosporin, macrolides, and carbapenem use, exceeding hospital population specific total use thresholds. Community-onset C difficile infection prevalence density was predicted by recent hospital C difficile infection rates, introduction of mandatory surveillance in individuals older than 65 years, and primary-case use of fluoroquinolones and clindamycin exceeding total use thresholds. Compared with predictions without intervention, C difficile infection prevalence density fell by 68% (mean reduction 1·01 per 1000 occupied bed-days, 0·27-1·76, p=0·008) in hospitals and 45% (0·083, 0·045-0·121 cases per 100 000 inhabitant-days, p<0·0001) in the community, during antibiotic stewardship. We identified no significant effects from other interventions. Limiting population use of 4C antibiotics reduced selective pressures favouring multidrug-resistant epidemic ribotypes and was associated with substantial declines in total C difficile infections in northeast Scotland. Efforts to control C difficile through antibiotic stewardship should account for ribotype distributions and non-linear effects. NHS Grampian Microbiology Endowment Fund.