It is unclear whether vitamin D lowers risk of type 2 diabetes (T2D). In an observational study, we assessed the prospective association between plasma 25-hydroxyvitamin D (25(OH)D) and incident T2D, and evaluated whether it holds up for genetically determined elevated 25(OH)D. We used a case-cohort study nested within the German arm of the European Prospective Investigation into Cancer. From a total cohort of 53,088 participants with a mean follow-up of 6.6 years, we identified a random subcohort of 2,121 participants (57% women) and 1,572 incident cases of T2D. 25(OH)D was measured in baseline plasma samples retrieved from frozen storage. Mean plasma 25(OH)D in the subcohort was 47.1 (5th-95th percentile 19.6-80.7) nmol/L. After controlling for age, sex, center, season of blood draw, education, and lifestyle, the hazard of T2D decreased across increasing plasma concentrations of 25(OH)D (P linear trend<0.0001). The association became non-linear after adjustment for BMI and waist circumference (P non-linearity<0.0001), with the inverse association being restricted to participants with 25(OH)D concentrations below ~45 nmol/L (hazard ratio per 5 nmol/L higher 25(OH)D 0.91, 95% CI 0.84-0.98). A score predicting genetically determined plasma 25(OH)D by weighting four independent single-nucleotide polymorphisms by their effect on 25(OH)D, explained 3.7% of the variance in 25(OH)D. The hazard ratio (95% CI) per 5 nmol/L higher genetically predicted 25(OH)D was 0.98 (0.89-1.08) in the entire study sample and 1.06 (0.93-1.21) in the sub-sample with 25(OH)D<45 nmol/L. This latter finding casts doubt on a strong causal association of 25(OH)D with T2D, but further research in large-scale consortia is needed.