Background:Long-term cancer, cardiovascular disease, diabetes and osteoarthritis may increase the risk of mental disorders, but which was more harmful and whether the associations differed between genders is unclear. Methods:We included 115,094 participants (54.3% women) aged 45-64 years from the 45 and Up Study who were free of depression, anxiety, and Parkinson's disease at baseline (2006-2009). The incidence of depression and anxiety was identified using claim databases during follow-up until December 2016. Cox regression models were used to examine the association of cancer, cardiovascular disease, diabetes, and osteoarthritis at baseline with incident depression and anxiety. Findings:During a mean eight-year follow-up (958,785 person-year), the cumulative incidence of depression and anxiety was 12.5% and 5.9% in the healthy population. Hazard ratios ([HRs] (95% CI) versus healthy population) for incident depression associated with long-term cancer, cardiovascular disease, diabetes, and osteoarthritis were 1.19 (95% CI: 1.13-1.25), 1.08 (1.00-1.16)), 1.18 (1.09-1.28), and 1.94 (1.80-2.10), respectively. The corresponding HRs (95% CIs) for incident anxiety were 1.11 (1.03-1.20), 1.26 (1.14-1.39), 1.10 (0.98-1.24), and 2.01 (1.80-2.23), respectively. The positive association between cancer and incident depression was more evident in men (HR (95% CI): 1.24 (1.13-1.35) than in women (1.14 (1.07-1.21). Long-term diabetes was an independent risk factor for incident anxiety in men (1.21 (1.02-1.44) but not in women (1.09 (0.93-1.28)). Interpretation:Long-term osteoarthritis, cardiovascular disease, and cancer were independent risk factors for incident depression and anxiety in both genders with osteoarthritis having the highest relative risk.