Babies born to mothers who were obese during pregnancy are three times more likely to develop type 2 diabetes in later life, research suggests.
Being overweight but not obese during pregnancy also increases the risk by almost half, it was found.
A research team studied more than 100,000 people born between 1950 and 2011 in the Aberdeen area.
The team linked the data with health records from the national register for diagnosed diabetes in Scotland.
As well as diabetes, the list of health problems linked to obese pregnant women included heart disease and early death.
The Aberdeen study, carried out by researchers at the University of Edinburgh, revealed about one quarter of women were overweight during pregnancy over the 60-year period.
One in 10 were categorised as obese, with a body mass index (BMI) greater than 40.
The proportion of obese mothers increased five-fold from about one in 30 during the 1950s to almost one in six between 2000 and 2011.
Children from mothers who were overweight or obese during pregnancy were found to be more likely to develop either type 1 or type 2 diabetes in their lifetime. Risks were higher for type 2 diabetes.
The researchers did not look at BMI of the offspring, or other lifestyle factors such as diet and exercise that are known to increase risk of type 2 diabetes.
They said shared lifestyle between a mother and her child could contribute to the development of the condition.
What is type 2 diabetes?
Type 2 diabetes is a chronic condition associated with obesity and family history and is more likely to be diagnosed in older people. It's more common than type 1 diabetes.
It is caused by problems with controlling blood sugar levels - either because the pancreas does not produce enough insulin, or if a body's cells do not react to insulin as they should.
The condition is treated by medication or controlling a person's diet.
One theory is that obesity may cause an adverse environment in the womb, where high levels of sugar and insulin trigger metabolic processes in the foetus that lead to diabetes.
About half of all women of childbearing age are overweight or obese in the UK, recent figures suggest.
The researchers said there was an urgent need to establish effective interventions to prevent obesity during pregnancy.
The study, published in the journal Diabetologia, was funded by baby charity Tommy's and the UK Medical Research Council.
'Cycle of ill-health'
Prof Rebecca Reynolds, of the Tommy's Centre for Maternal and Fetal Health at the University of Edinburgh, said: "We found an increased risk of developing diabetes in children born to obese mothers, which was not linked to socio-demographic factors.
"Our findings underline the urgent need to find ways of helping women plan for pregnancy by optimising their health - including reaching and maintaining a healthy weight."
Jane Brewin, chief executive of Tommy's, said the cycle of ill-health caused by obesity was "particularly damaging to future generations".
She added: "We need wider awareness of the importance of health before conception as well as supportive and accessible programmes that help women who have a high BMI to lose weight before pregnancy and manage their weight during pregnancy.
"This would return dividends with a healthier future generation as well as reducing the many pregnancy complications associated with obesity."