Background: Observational research reports positive associations between type 2 diabetes mellitus (T2DM) and obesity-related cancers (ORCs), but causality remains unclear due to confounding (namely the shared risk factor of obesity, commonly approximated as body mass index, BMI), immortal time bias, and detection-time bias. Here, we aimed to use causal inference methods to minimise the above problems and estimate causal associations between new-onset T2DM and incident cancer. Methods: We performed a cohort study within UK Biobank, comparing new-onset T2DM with unexposed individuals matched 1 to 3 on BMI, age, and sex using a sequential longitudinal approach. The primary outcomes were total incident cancer, divided into ORCs and non-obesity-related cancers (NORCs). The secondary outcomes were site-specific cancers. We developed Cox models to estimate time-split hazard ratios (tsHRs) and 95% confidence intervals (CIs) stratified by sex. Findings: 23,771 participants with new-onset T2DM were matched with 71,170 unexposed participants. During a median follow-up of 5 years, there were 7694 (T2DM: 2432; unexposed: 5262) incident cancers. In men, there was evidence for an effect of T2DM on obesity-related cancer (tsHR 1.39, 95% CI 1.21-1.59), particularly on hepatocellular carcinoma (tsHR 3.97, 95% CI 2.38-6.65), pancreatic (tsHR 1.77, 95% CI 1.15-2.72) and kidney (tsHR 1.62, 95% CI 1.13-2.32) cancers. In women, there was evidence for an effect on obesity-related cancers (tsHR 1.33, 95% CI 1.16-1.52). Importantly, there were no associations with post-menopausal breast and endometrial cancers, two cancer types consistently associated with elevated BMI. There was no effect of new-onset T2DM on incidence of NORCs. There was evidence of detection-time bias, particularly in men. Interpretation: This is the first large-scale study to demonstrate evidence of a BMI-independent associations between new-onset T2DM and incident cancer. In men, this was primarily driven by hepatocellular carcinoma, pancreatic cancer, and kidney cancer. In women, the underlying cancers driving this relationship were less clearly defined. Funding: This study was funded by Cancer Research UK and administered through the Manchester Cancer Research Centre MB-PhD scheme (SEBCATP-2023/100010).