Image copyright Getty Images Image caption Ginkgo leaves in autumn

Scientists have discovered the secret of how the ginkgo tree can live for more than 1,000 years.

A study found the tree makes protective chemicals that fend off diseases and drought.

And, unlike many other plants, its genes are not programmed to trigger inexorable decline when its youth is over.

The ginkgo can be found in parks and gardens across the world, but is on the brink of extinction in the wild.

"The secret is maintaining a really healthy defence system and being a species that does not have a pre-determined senescence (ageing) programme," said Richard Dixon of the University of North Texas, Denton.

"As ginkgo trees age, they show no evidence of weakening their ability to defend themselves from stresses."

Image copyright Getty Images Image caption A man walks on fallen leaves under gingko trees as autumn arrives in the Chinese capital, Beijing

Ginkgo biloba (Maidenhair tree)

A slow growing, ultimately large tree

Attractive yellow leaves in the autumn

The ginkgo is native to China and the last survivor of a long line of ancient trees, with fossils known from the time of the dinosaurs

Wild populations are on the brink of extinction due to logging, with wild populations confined to Xitianmu Mountain in Zhejiang, China

Listed as endangered in the IUCN red list of threatened species (Ginkgo biloba).

Researchers in the US and China studied ginkgo trees aged 15 to 667, extracting tree-rings and analysing cells, bark, leaves and seeds. They found both young and old trees produce protective chemicals to fight off stresses caused by pathogens or drought.

These include anti-oxidants, antimicrobials and plant hormones that protect against drought and other environmental stressors. Genetic studies showed that genes related to ageing didn't automatically switch on at a certain point in time as in other plants, such as grasses and annuals.

Thus, while a tree that has lived for centuries might appear dilapidated due to frost damage or lightning strikes, all the processes needed for healthy growth are still functioning.

Image caption Ginkgo trees grow widely in gardens, including at RHS Wisley, UK

Dr Dixon suspects the picture will be similar in other long-lived trees, such as the giant redwood, which has wood "packed with antimicrobial chemicals".

"Hopefully our study will encourage others to dig deeper into what appear to be the important features for longevity in ginkgo and other long-lived trees," he said.

Commenting on the study, Mark Gush, head of horticultural and environmental science at the RHS (Royal Horticultural Society), said the oldest living tree in the world - a Bristlecone pine (Pinus longaeva) - is estimated to be more than 4,800 years old.

"Apart from a consistent supply of food, light and water, the ability to live to such a great age is thought to be linked to slow growth rate, cellular adaptations and relative protection from secondary influences such as pest and disease, climate extremes and catastrophic physical damage," he said.

As the UK embarks on an ambitious tree planting programme, understanding the mixture of tree species that will deliver the greatest ecosystem rewards over the long term, and where they should best be planted, is likely to be increasingly important, he added.

The research is published in the journal PNAS.

Follow Helen on Twitter.