The analysis found that a cohort of poorer males within Generation X - those born between 1960 and 1980 - were at increased risk because of the economic and social conditions of the decades.
Being A Scout Or Guide 'Can Help Improve Mental Health In Later Life'
Joining the Scouts or Guides appears to help lower the risk of mental illness in later life, a study suggests.
Children who participate in the organisations - which aim to develop qualities such as self-reliance, resolve and a desire for self-learning - are likely to have better mental health in middle age, the findings show.
Such activities, which frequently involve being outdoors, also seem to remove the relatively higher likelihood of mental illness in those from poorer backgrounds.
The findings were drawn from a lifelong study of almost 10,000 people from across the UK who were born in November 1958, known as the National Child Development Study.
Scientists from the universities of Edinburgh and Glasgow, who analysed the data, found those who had belonged to the groups tended to have better mental health aged 50.
Around one-quarter of study participants had been in the Scouts or Guides, and those were found to be around 15% less likely to suffer from anxiety or mood disorders, compared with others.
Lead researcher Professor Chris Dibben, of the University of Edinburgh's School of GeoSciences, said: ''It is quite startling that this benefit is found in people so many years after they have attended Guides or Scouts.
''We expect the same principles would apply to the Scouts and Guides of today and so, given the high costs of mental ill health to individuals and society, a focus on voluntary youth programmes such as the Guides and Scouts might be very sensible.''
Researchers say their findings suggest programmes that help children develop skills such as self-reliance and teamwork, and encourage being active outdoors, may have lifelong benefits.
Attending the Guides or Scouts may help build resilience against common stresses in life, or it may increase a person's chances of achieving more in life, so they are less likely to experience such stresses, researchers suggest.
The study, supported by the Economic and Social Research Council, was published in the Journal of Epidemiology and Community Health.
Professor Richard Mitchell, of the Centre for Research on Environment, Society and Health at the University of Glasgow, said: ''Governments and health services around the world struggle to do something about the health gap between richer and poorer people, so this new evidence that being a Scout or Guide can help is very important.''
Bear Grylls, chief Scout at the Scout Association, said: ''I am really proud that Scouting provides young people with an opportunity to develop the skills they need to be resilient and deal with what life throws at them.
''Through initiatives such as our A Million Hands Campaign, the Scout Association is helping give young people the ability to develop mental wellbeing throughout their lives.''
Emma Brodey, 18, a member of the Girlguiding Advocate Panel, said: ''Women tell us every week that their accomplishments and memories through Guiding have lasted throughout their lives, so it's amazing to see research showing the long-term benefits of being a member of Girlguiding.''
Scottish Government waiting-time targets of 18 weeks were missed for 3,666 children in the year to March 2017.
The study found that while some over-60s felt well looked after by prison staff, others were not having their needs met by the system.
We're told it was started deliberately.
Most Viewed Pictures On Heart
Recently Played Tracks
To listen live, choose your preferred station:
Now playing: The best feel good music
Deposit £10 to get a £40 Welcome Bonus - That's £50 to play bingo, slots and more!*
Over 50 tracks to make you feel-good. New album out now...
Find your local four day weather report here.
Make Heart the soundtrack to your day and you could be a winner with great prizes up for grabs throughout the day.
Find out more about some of the companies advertising on Heart Scotland- East.