A diet rich in bananas, chickpeas and peanuts improves gut bacteria in malnourished children, helping kick-start their growth, research suggests.
These foods were found to be particularly good at boosting healthy microbes, in a US study of children in Bangladesh.
The growth of bones, brains and bodies is then more likely.
The World Health Organization said about 150 million children under five around the world were malnourished.
As well as being weak and small, many malnourished children end up with incomplete or "immature" communities of bacteria in the gut, compared with healthy children of the same age.
Boosting good bacteria
This is what scientists from Washington University, in St Louis, believed could be the cause of poor growth - but not all foods are equally good at fixing the problem.
Researchers had studied the main types of bacteria present in the healthy guts of Bangladeshi children.
And they had then tested which sets of foods boosted these important bacterial communities in mice and pigs.
Next, in a one-month trial, reported in the journal Science, involving 68 malnourished Bangladeshi children aged 12-18 months, the research team tested out different diets on small groups.
After closely monitoring the children's recovery, one diet stood out - which contained bananas, soy, peanut flour and chickpeas in a paste.
This diet was found to boost gut microbes linked to bone growth, brain development and immune function.
It also used ingredients that were affordable and acceptable to people in Bangladesh.
Prof Jeffrey Gordon, from Washington University, who led the research with colleagues from the International Centre for Diarrhoeal Disease Research in Dhaka, Bangladesh, said the aim had been "to target microbes to heal".
"Microbes don't see bananas or peanuts - they just see a blend of nutrients they can use and share," he said.
"This formulation worked best in animals and humans, producing the greatest repair."
Other diets, dominated by rice or lentils, fared less well and sometimes damaged the gut even more.
Prof Gordon said it wasn't yet completely clear why these foods worked best but a much larger trial was now being carried out to see if the diet had long-term effects on children's weight and height gain.
"This is a community of microbes that extends far beyond the gut," he said.
"It is intimately linked to health status and we need to figure out the mechanisms so they can also be repaired later in life."
He added that in other countries, different foods may have similar effects.
What is the microbiome?
- You're more microbe than human - if you count all the cells in your body, only 43% are human
- The rest is your microbiome and includes bacteria, viruses, fungi and single-celled archaea
- The human genome - the full set of genetic instructions for a human being - is made up of 20,000 instructions called genes
- But add all the genes in your microbiome together and the figure comes out at between two million and 20 million microbial genes
- It's known as the second genome and is linked to diseases including allergy, obesity, inflammatory bowel disease, Parkinson's, whether cancer drugs work and even depression and autism