The researchers from Oxford University, working with a team from Sri Lanka and the University of Bradford, analysed the carbon and oxygen isotopes in the teeth of 26 individuals,with the oldest dating back 20,000 years.

They found that nearly all the teeth analysed suggested a diet largely sourced from the rainforest.

The study, published in the the journal Science shows that early modern humans adapted to living in the rainforest for long periods of time.

Previously it was thought that humans did not occupy tropical forests for any length of time until 12,000 years after that date, and that the tropical forests were largely 'pristine', human-free environments until the Early Holocene, 8,000 years ago.

Scholars reasoned that compared with more open landscapes, humans might have found rainforests too difficult to navigate, with less available food to hunt or catch.

"This is the first time scientists have investigated ancient human fossils in a tropical forest context to see how our earliest ancestors survived in such a habitat," co-author Professor Julia Lee-Thorp from Oxford University said.

The researchers studied the fossilized teeth of 26 humans of a range of dates. All of the teeth were excavated from three archaeological sites in Sri Lanka, which are today surrounded by either dense rainforest or more open terrain.

The analysis of the teeth showed that all of the humans had a diet sourced from slightly open 'intermediate rainforest' environments.

Only two of them showed a recognisable signature of a diet found in open grassland. However, these two teeth were dated to around 3,000 years, the start of the Iron Age, whenagriculture developed in the region.

"This is the first study to directly test how much early human forest foragers depended on the rainforest for their diet," lead author Patrick Roberts said.

"The results are significant in showing that early humans in Sri Lanka were able to live almost entirely on food found in the rainforest without the need to move into other environments. Our earliest human ancestors were clearly able to successfully adapt to different extreme environments," said Roberts.