Taking part in 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 results showed.
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 that those who had belonged to the scouts or guides tended to have better mental health at age 50.
Around one-quarter of study participants had been in the scouts or guides, and those were found to be around 15 per cent less likely to suffer from anxiety or mood disorders, compared with others.
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 that 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.
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."
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 of 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: "Girlguiding is, and for over 100 years now has been, for the girl. It offers a safe space where they can be themselves, build their confidence and escape from the ever-increasing pressures in their lives. 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."
Journal of Epidemiology & Community Health