Taste for high-fat food `in our genes`
Some of the meals were packed with fat while others were low-fat versions.
Those with a gene already linked to obesity showed a preference for the high-fat food and ate more of it.
Fat genes
The gene in question is called MC4R.
It is thought about one in every 1,000 people carries a defective version of this gene which controls hunger and appetite as well as how well we burn off calories.
Mutations in MC4R are the most common genetic cause of severe obesity within families that has so far been identified.
Humans probably evolved hunger genes to cope in times of famine, say experts.
When food is scarce it makes sense to eat and store more fat to fend off starvation.
But having a defect in the MC4R gene means hunger can become insatiable.
In the study, published in the journal Nature Communications, the researchers created a test menu that varied only in fat or sugar content.
The three versions of the main meal on offer - chicken korma - were identical in appearance, and as far as possible, taste, but ranged in fat from low to medium and high. The volunteers were offered a small sample of each and then left to eat as much as they liked of the three dishes.
The same was then done for a pudding of strawberries, meringue and cream, but this time varying the sugar content rather than the fat.
Although there was no overall difference in the amount of food the individuals ate, the 14 people with defective MC4R unwittingly ate significantly more of the high-fat korma than did the 20 lean individuals and the 20 obese people in the study who were included for comparison.
When it came to dessert, only the MC4R carriers disliked the high-sugar option.
Lead researcher Prof Sadaf Farooqi, from the Wellcome Trust Medical Research Council Institute of Metabolic Science at the University of Cambridge, said the findings suggest that at least part of our food preferences are down to biology rather than free will.
"Even if you tightly control the appearance and taste of food, our brains can detect the nutrient content.
"Most of the time we eat foods that are both high in fat and high in sugar. By carefully testing these nutrients separately in this study, and by testing a relatively rare group of people with the defective MC4R gene, we were able to show that specific brain pathways can modulate food preference."
It would appear that MC4R makes people value fat over sugar, which makes sense if the aim is to build up fat stores for energy, says Prof Farooqi.
Fat delivers twice as many calories per gram as carbohydrate or protein and can be readily stored in our bodies.
"Having a pathway that tells you to eat more fat at the expense of sugar, which we can only store to a limited extent in the body, would be a very useful way of defending against starvation."
But she said the findings did not mean that people were entirely helpless against primal urges. Eating a sensible diet and getting plenty of exercise is important for maintaining a healthy weight.