Ducks were the melting pot of viruses that led to the new bird flu emerging in China early this year, according to Chinese scientists tracking the evolution of the virus.
Ducks picked up viruses from migrating birds and passed them onto chickens.
The study, published in the journal Nature, showed humans were probably then infected with H7N9 due to contact with chickens at live poultry markets.
There have been 133 human cases of the bird flu and 43 deaths.
The team, including researchers at the Shantou University Medical College, were trying to trace the root of the outbreak.
They took samples from 1,341 chickens, ducks, geese, pigeons, partridges and quail as well as faecal and water samples from live poultry markets.
By comparing the similarities and differences between the genetic codes of influenza viruses in each of the animals, scientists can work out how the virus evolved and spread.
Their report said: "Domestic ducks seem to act as key intermediate hosts by acquiring and maintaining diverse influenza viruses from migratory birds.
"This probably led to outbreaks in chickens resulting in the rapid spread of the [virus] through live poultry markets which became the source of human infections."
There have been very few cases since China introduced controls on live poultry markets.
The authors added: "To control H7N9 and related viruses ultimately it is necessary to reconsider the management of live poultry markets in urban areas."
The study also uncovered a similar bird flu called H7N7, which appears able to infect mammals. The scientists said this group of H7 bird flus may "pose threats beyond the current outbreak".
Commenting on the research, Dr Peter Horby, from the Oxford University Clinical Research Unit in Vietnam, said: "This kind of microbial forensics is essential in helping us piece together the origin of novel avian influenza viruses such as H7N9.
"When combined with analyses of poultry production and marketing systems, it can help us identify practices that might reduce the risks of H7N9 and other novel viruses re-emerging.
"Whilst this brings us closer to understanding the pathway to emergence, more detective work is needed to fully reveal the ecology and source of H7N9 viruses, which seem to be concentrated in live poultry markets but elusive elsewhere in the production chain.
"The discovery of a novel H7N7 lineage that can infect ferrets reminds us that even if H7N9 does not return, there are risks lurking amongst the great diversity of avian influenza viruses."