Image copyright SPL Image caption Neanderthals are our closest extinct relatives

Neanderthals dosed themselves with painkillers and possibly penicillin, according to a study of their teeth.

One sick Neanderthal chewed the bark of the poplar tree, which contains a chemical related to aspirin.

He may also have been using penicillin, long before antibiotics were developed.

The evidence comes from ancient DNA found in the dental tartar of Neanderthals living about 40,000 years ago in central Europe.

Microbes and food stuck to the teeth of the ancient hominins gives scientists a window into the past.

By sequencing DNA preserved in dental tartar, international researchers have found out new details of the diet, lifestyle and health of our closest extinct relatives.

"Their behaviour and their diet looks a lot more sophisticated and a lot more like us in many ways," said Prof Alan Cooper, director of the University of Adelaide's Australian Centre for Ancient DNA.

"You know, we've got a guy self-medicating either because he's got a dental abscess, which was bad, or a nasty gastrointestinal parasite, which was also bad, either way he wasn't a happy guy.

"And, here he is eating aspirin and we're finding penicillin mould in him."

Image copyright SPL Image caption Penicillium fungus on a petri dish

The Neanderthal's abscess left a trace on his jawbone. The intestinal parasite was identified through studying DNA in dental tartar.

It appears the Neanderthals had a good knowledge of medicinal plants and how these might relieve the pain of toothache or stomach ache. They might also have used antibiotics, long before the medicines were developed in modern times.

"The use of antibiotics would be very surprising, as this is more than 40,000 years before we developed penicillin," said Prof Cooper.

"Certainly our findings contrast markedly with the rather simplistic view of our ancient relatives in popular imagination."

Window on the past

The research also gives new details of the diet of Neanderthals. Neanderthals at a cave site in Belgium were prolific meat eaters, dining on rhinoceros and wild sheep supplemented with mushrooms. Others, living further south in Spain, were largely vegans, consuming moss, bark and pine nuts.

This DNA evidence contradicts archaeological and isotopic data suggesting Neanderthals were as carnivorous as polar bears or wolves, with a diet largely based on reindeer, woolly mammoth and woolly rhinoceros.

The researchers also examined bacteria that lived in the mouths of Neanderthals to see how microbial flora has changed over time. In the process, they reconstructed the oldest microbial genome yet sequenced - a bacteria associated with gum disease that is 48,000 years old.

They discovered that the collection of bacteria in the mouths of ancient populations seems to be linked to the amount of meat in the diet.

"This extraordinary window on the past is providing us with new ways to explore and understand our evolutionary history through the microorganisms that lived in us and with us," said Prof Keith Dobney, from the University of Liverpool, a co-researcher on the study.

Neanderthals lived between about 400,000 and 40,000 years ago in Europe and southwestern to central Asia.

They occasionally interbred with modern humans, meaning their genes live on today.

The research is published in the journal Nature.

Follow Helen on Twitter.