Diabetes is a common age-dependent complication of cystic fibrosis (CF) that is strongly influenced by modifier genes. We conducted a genome-wide association study in 3,059 individuals with CF (644 with CF-related diabetes [CFRD]) and identified single nucleotide polymorphisms (SNPs) within and 5' to the SLC26A9 gene that associated with CFRD (hazard ratio [HR] 1.38; P = 3.6 × 10(-8)). Replication was demonstrated in 694 individuals (124 with CFRD) (HR, 1.47; P = 0.007), with combined analysis significant at P = 9.8 × 10(-10). SLC26A9 is an epithelial chloride/bicarbonate channel that can interact with the CF transmembrane regulator (CFTR), the protein mutated in CF. We also hypothesized that common SNPs associated with type 2 diabetes also might affect risk for CFRD. A previous association of CFRD with SNPs in TCF7L2 was replicated in this study (P = 0.004; combined analysis P = 3.8 × 10(-6)), and type 2 diabetes SNPs at or near CDKAL1, CDKN2A/B, and IGF2BP2 were associated with CFRD (P < 0.004). These five loci accounted for 8.3% of the phenotypic variance in CFRD onset and had a combined population-attributable risk of 68%. Diabetes is a highly prevalent complication of CF, for which susceptibility is determined in part by variants at SLC26A9 (which mediates processes proximate to the CF disease-causing gene) and at four susceptibility loci for type 2 diabetes in the general population.