The relationship between type 2 diabetes and gout is complex. The objective of this study was to understand the role of diabetes itself and its comorbidities within the association between type 2 diabetes and gout.We conducted a retrospective cohort study using the UK Clinical Practice Research Datalink (CPRD) GOLD. Persons with type 2 diabetes were identified as persons on a noninsulin antidiabetic drug (NIAD) between 2004 and 2012, and were matched to 1 control based on age, sex, and general practice. We estimated gout risk in NIAD users using Cox regression analysis. All analyses were stratified for sex.In total, 221,117 NIAD users were identified. NIAD users had an increased risk of gout (hazard ratio (HR) 1.48; 95% CI 1.41-1.54). This association was stronger in women (HR 2.23; 95% CI 2.07-2.41) compared with men (HR 1.19; 95% CI 1.13-1.26). After adjustments for BMI, eGFR, hypertension, renal transplantation, diuretics, statins, low-dose aspirin, ciclosporin, and tacrolimus, the risk disappeared in women (HR 1.01; 95% CI 0.92-1.11) and reversed in men (HR 0.61; 95% CI 0.58-0.66) (P for interaction <0.001). When stratifying gout risk according to HbA1c in male and female NIAD users, we found an inverse association between raising HbA1c and incident gout in men only. Further adjustment gave similar results.Individuals with type 2 diabetes are at increased risk of gout. This is not due to diabetes itself, but to the comorbid conditions. Diabetes itself is apparently associated with a decreased risk of gout, especially in men.