The secrets of how malaria became a human-killer have been revealed by a genetic study.
The work, led by researchers from Wellcome Sanger Institute in Cambridge, compared seven types of malaria - tracing the parasite's family tree.
This revealed that, about 50,000 years ago, the parasites diverged, with one "branch" evolving into the most deadly human-infecting species.
The findings are published in the journal Nature Microbiology.
One element of this diversion was a genetic switch that enabled malaria to infect human red blood cells - a "chunk of deadly DNA" that previous studies suggest could yet provide a target for a malaria-blocking vaccine.
"Our study has pieced together the sequential series of steps that set up the critical storm. allowing the parasites to not only enter humans but to stay, divide and be transferred by mosquitoes," explained one of the lead researchers, Dr Matt Berriman.
According to the World Health Organization, more than 200 million people are infected with malaria every year; the disease caused the deaths of almost half a million people globally in 2016, and the majority of those deaths were children under the age of five.
By far the deadliest species of the parasite which causes this global health scourge is Plasmodium falciparum.
While this species infects and often kills people when injected through the bite of a female Anopheles mosquito, there are many other related species which infect some of our great ape cousins - chimpanzees and gorillas.
To study those, the researchers collaborated with a team caring for injured and orphaned apes in a sanctuary in Gabon. As part of the animals' health checks, veterinary staff take blood samples from them.
"It turns out that healthy animals have a really high background level of parasites in their blood," Dr Berriman told BBC News. "[These animals] are blissfully ignorant of the scientific value in their blood."
The blood samples provided a series of malarial genetic codes that the scientists could use to trace its evolutionary history.
"We don't have fossils for tracing the history of a parasite," said Dr Berriman.
But comparing the genomes of these malaria species allowed him and his team to trace back how the genetic code had been "reshuffled" as the parasite evolved - and how and when that shuffling led to the deadly genetic recipe that is Plasmodium falciparum.
The researchers examined seven different types of malaria - three that infect chimpanzees, three that infect gorillas and the deadly human-infecting species.
Scientists discovered that the evolutionary lineage leading to Plasmodium falciparum emerged 50,000 years ago, but did not fully diverge as a human-specific parasite species until 3,000 to 4,000 years ago.
"The recent expansion of modern humans created the home in which the parasites irreversibly evolved into a human-specific form," explained Dr Berriman.
Prof Janet Hemingway, director of the Liverpool School of Tropical Medicine said the discovery was "really important" because it built a picture of how and when a disease crossed the species barrier, going on to become a deadly human disease.
Understanding how that happens, could enable scientists to recognise - and even avoid - patterns that might lead to the same scenario in future.
"These days most people think of malaria as a human disease, and forget that this was a zoonotic disease that crossed the species barrier 50,000 years ago and then co-evolved with its new human host to become one of the most deadly diseases known to man," said Prof Hemingway.
"It does perhaps underline why it is so important that we react to current movement of animal parasites and viruses into humans and do not give them chance to become permanently transmitted from human to human."