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."