As a part of the study the researchers looked at 2,127 men born between 1938 and 1957.
They also looked at 3,100 women, but for no such link in the fairer sex.
Further analysis showed that the link existed even after taking into account other factors including age, body mass index, family history of diabetes, smoking, physical activity and socio-economic background.
"The link could be a result of the way psychological distress affects the brain's role in regulating hormones or perhaps because depression influences a person's diet and level of physical activity in a negative way," BBC News quoted study leader Professor Anders Ekbom, from the Karolinska Institute, as saying.
He added that stress and depression were already known to be risk factors for heart disease.
As for why only men and not women were at a higher risk, Prof Ekbom said that it may be because the two genders have different coping strategies.
"While women communicate symptoms of distress and depression, men are more unwilling to admit such feelings and tend to cope through drinking, drug use and other private activities or actions."
Dr Iain Frame, director of research at Diabetes UK, said: "It is intriguing that the increased risk of diabetes occurs in men only and it would be interesting to find out why.
"The results suggest that it could be due to a hormonal or behavioural influence.
"We already know from previous studies that stress is considered to be a risk factor for type 2 diabetes and others have looked at the link between sleep disorders, such as insomnia, and the condition.
"This research appears to confirm that there might be something in this."
The study appears in the journal Diabetic Medicine.