Cancer incidence was ascertained in a population-based cohort of 51,008 patients in Uppsala, Sweden, who were given a discharge diagnosis of diabetes mellitus during 1965-83. Complete follow-up through 1984 with exclusion of the first year of observation showed that the observed number of cancers in females (1,294) was eight percent higher than expected (relative risk [RR] = 1.1, 95 percent confidence interval = 1.0-1.1), whereas in males the observed number (1,123) was close to the expected (RR = 1.0, 0.9-1.1). Significantly increased risks of pancreatic (RR = 1.4, 1.2-1.7), primary liver (RR = 1.5, 1.2-1.7), and endometrial (RR = 1.5, 1.2-1.8) cancers and a lower than expected number of prostatic cancers (RR = 0.7, 0.7-0.9) were found in this cohort of diabetic patients. The excess risk of pancreatic cancer was similar in females and males and evident both during one through four years (RR = 1.7, 1.4-2.1) and five through nine years (RR = 1.3, 0.9-1.7) of follow-up, but not thereafter. A similar pattern was found for primary liver cancer, but the RRs were generally higher in males than in females.