But Western diets, abundant in saturated fats, have been blamed for people in the UK and the US eating too much of it.
Researchers at Aberdeen University and the Chinese Academy of Sciences led the rodent study, considered the largest of its kind.
A major drawback in conducting human studies on the effects of diets is time, as most don't last long enough to draw concrete conclusions.
However, studies on animals that are genetically similar, such as mice, could help point researchers in the right direction.
Professor John Speakman, who led the study, said the new findings offer a 'good clue' as to what the different diets may do to humans.
A total of 30 different diets were given to mice over a period of three months - the equivalent of nine human years.
Each varied in their fat, carbohydrate (sugar) and protein content.
More than 100,000 measurements of body weight changes of mice were made, including a micro MRI machine to assess body fat.
Professor Speakman said: "The result of this enormous study was unequivocal – the only thing that made the mice get fat was eating more fat in their diets.
"These effects of dietary fat seemed to be because uniquely fat in the diet stimulated the reward centres in the brain, stimulating greater intake."
Mice fed carb-loaded diets, including up to 30 per cent of their calories coming from sugar, gained no significant weight.
And combining sugar with fat had no more impact than fat alone, revealed the study, published in Cell Metabolism.
Professor Speakman and colleagues also debunked a widely-held belief that low protein diets can stimulate a greater intake of food.
They uncovered "no evidence" that diets based on low protein, slashed to five per cent of calories, encouraged mice to eat more.
Professor Speakman said: "We are never going to do studies where the diets of humans are controlled in the same way for such long periods. So the evidence it provides is a good clue to what the effects of different diets are likely to be in humans."
During the 1980s and 1990s, it was widely accepted that the most important factor in weight gain is the fat content of our diets.
However, at the turn of the century it was suggested this focus on fat was misplaced, and the main factor driving obesity was refined carbs.
Several hugely popular books were published in this period suggesting that eating fat might actually protect us from obesity.
In recent years, however, attention has turned to protein, with the hypothesis that people eat food mostly to obtain protein rather than energy.
According to this idea, when the protein content falls, humans eat more to meet the target protein intake - causing them to consume too many calories.