Humans may have originally caught malaria from gorillas, scientists say.
Until now, it was thought that the human malaria parasite split off from a chimpanzee parasite when humans and chimpanzees last had a common ancestor.
But researchers from the US, three African countries, and Europe have examined malaria parasites in great ape faeces.
They found the DNA from western gorilla parasites was the most similar to human parasites.
Malaria is caused by a parasite called Plasmodium, and is carried by mosquitoes.
The most common species found in Africa, Plasmodium falciparum, causes dangerous cerebral malaria. Over 800,000 people die from malaria each year in the continent.
Until now, scientists had assumed that when the evolutionary tree of humans split off from that of chimpanzees - around five to seven million years ago - so had Plasmodium falciparum.
This would have meant that humans and malaria co-evolved to live together. But new evidence suggests human malaria is much newer.
Dr Beatrice Hahn of the University of Alabama at Birmingham, in the US, is part of a team that had been studying HIV and related infections in humans and great apes.
To study the DNA of infections in wild apes, you cannot use blood samples. So the team collected 2,700 samples of faecal material from two species of gorilla - western and eastern - and from common chimpanzees and bonobos, also known as pygmy chimpanzees.
They tried sequencing Plasmodium DNA from the faeces with techniques that use a large sample, and drew a genetic family tree to see which parasites were related. Dr Hahn said "When we did conventional sequencing, the tree didn't make any sense, because each sample contained a mixture of parasites."
They diluted the DNA so that they had just one parasite's genome represented in a single sample, and then amplified the DNA from there. This means they were able to separate the DNA from different species of the parasite much more effectively.
They then found the tree made much more sense. But they also found some surprising results.
The human Plasmodium was not very closely related to chimpanzee Plasmodium, as had been thought - but it was very closely related to one out of three species of gorilla Plasmodium from western gorillas in Central and West Africa.
There was more genetic variety in the gorilla parasites than in human parasites, and Dr Hahn said this means the gorilla is likely to be the "reservoir" - the origin of the human parasite.
"Other studies have just looked at chimps, so didn't find the gorilla parasite," said Dr Hahn. She added that some studies have looked at animals in captivity - so it is possible any parasites have "jumped" from their human keepers.
The researchers, who report their findings in Nature, are now going to investigate further to see exactly how different the gorilla and human parasites are. Dr Hahn says that it is possible they are even the same species, and that cross-infection between humans and gorillas may be going on now.
Members of the team Dr Martine Peeters and Dr Eric Delaporte of the University of Montpelier in France are working with hunters and loggers in Cameroon, who spend a lot of time in the forests.
They will investigate whether these workers carry malaria parasites from the gorillas, which would suggest that new infections from other species can still happen.
They also do not yet know how badly apes are affected by malaria. Dr Hahn said that the team would now like to find out whether apes are able to catch the malaria parasite, without getting ill or dying in the way that humans do.