People who take part in a range of leisure activities in middle age are more likely to stay mentally sharp in later life, according to new research.

Psychologists at the University of Edinburgh and Heriot-Watt University tested more than 500 people aged 79 for memory, problem solving and thinking ability.

They then repeated the same tests every three or four years until participants were 90.

Researchers found those who had hobbies such as going to the theatre, gallery visits, or reading and writing in their 40s and 50s scored better on memory and thinking tests as they approached 80.

Analysis also showed people who were more physically active in later life were more likely to stay mentally sharp.

Researchers used statistical models to analyse participants' leisure and physical activity during different periods of their lives - aged 20-35, 40-55 and 60-75.

The team took into account the results of intelligence tests taken by participants when they were 11, and also factored in current lifestyle factors, their education and socio-economic status.

Professor Ian Deary, director of the centre for cognitive ageing and cognitive epidemiology at the University of Edinburgh, said: "There are good health and social reasons for being physically and culturally active in older age. If they are associated with better thinking skills too, that's a bonus.

"Our team continues to look out for more factors that might boost healthy ageing, both cognitive and physical."

Analysis revealed leisure activities during middle age explained about 6% of differences in performance on the thinking and memory tests at the age of 79.

Physical activity, meanwhile, accounted for 12% of differences in a change in thinking skills in older age.

Dr Alan Gow, associate professor at Heriot-Watt University in Edinburgh, who led the study, said: "These latest findings add to the growing evidence that being more engaged in leisure activities throughout middle age might be associated with better thinking skills in later life.

"For those in their 70s or beyond, another positive message seems to be that keeping physically active may be an important behaviour in terms of reducing cognitive decline."