In recent years, many nutrition experts have linked the obesity epidemic to the spread of ultra-processed foods that are engineered to have a long shelf life and irresistible combinations of salt, sugar, fat and other additives.

These foods tend to make people overeat because they are full of refined carbohydrates, added sugars and fat that appeal to the human palate, experts say. Most of these foods, however, tend to lack fiber, protein, vitamins and other important nutrients.

Now a small but rigorous new study provides strong evidence that not only do these foodstend to make people eat more, but they also may result in dramatic and relatively rapid weight gain and have other detrimental health effects.

The research,published Thursday in the journal Cell Metabolism, found that people ate significantly more calories and gained more weight when they were fed a diet that was high in ultra-processed foods like breakfast cereals, muffins, white bread, sugary yogurts, low-fat potato chips, canned foods, processed meats, fruit juices and diet beverages. These foods caused a rise in hunger hormones compared to a diet that contained mostly minimally processed foods like fresh fruits and vegetables, eggs, grilled chicken, fish and beef, and whole grains, nuts and seeds.

The subjects were recruited by scientists at the National Institutes of Health and assigned to live in a research facility for four weeks. There they were fed both diets — a whole foods diet or an ultra-processed one, along with snacks in each category — for two weeks each and carefully monitored. They were instructed to consume as much or as little as desired.

The most striking finding was that the ultra-processed diet led the subjects to consume 500 extra calories a day — the amount in two and a half Krispy Kreme glazed doughnuts — which resulted in an average of two pounds of weight gain in two weeks. Almost all of the extra calories they ate were from carbs and fat.

“It’s a substantial amount of calories, and it did translate over a relatively short period of time into some substantial weight and body fat changes,” said Kevin Hall, the lead author of the study and an obesity expert at the National Institute of Diabetes and Digestive and Kidney Diseases. “I was surprised by the magnitude of the changes we saw.”

Barry Popkin, a global obesity and nutrition expert at the University of North Carolina at Chapel Hill who was not involved in the study, called the research impressive and said that the weight gained on the ultra-processed diet in a short period of time was “profound.” He said that the new findings, along with previous studies, raise questions about whether food manufacturers can create healthier processed foods that do not induce people to overeat.

“This is a very important study and a major challenge to the global food industry and the food science profession,” Dr. Popkin said.

The new study, the first clinical trial to directly compare how ultra-processed foods and unprocessed foods influence health, could have important implications. Ultra-processed foods make up more than half of the calories that Americans consume, and they are becoming increasingly widespread across the globe as multinational food companies push deeper into developing countries.

While there are many ways to define ultra-processed foods, they are typically packaged or fast foods that contain many ingredients, such as added sugars, refined carbohydrates, industrial oils, sodium and synthetic flavors and preservatives. Observational studies of thousands of people have found that eating high amounts of these foods is associated with a greater likelihood of early death from heart disease and cancer.

But people in lower socioeconomic brackets tend to consume the most ultra-processed foods. They also tend to smoke more, exercise less and engage in other unhealthy behaviors. As a result, large population studies cannot entirely separate the effects of eating ultra-processed foods from other lifestyle factors that influence disease risk.

The new study was designed to get around this problem by recruiting healthy adults whose average age was 31 and assigning them to eat both an unprocessed and an ultra-processed diet. The number of people in the study was necessarily small — 20 men and women — because the subjects had to spend four weeks living in a research facility eating only their prescribed diets. The researchers prepared all their meals and snacks, tracked every morsel of food that they ate, and carefully analyzed the effects of those foods on their weight, body fat, hormones and other biomarkers.

The researchers wanted to make sure that the processed diet did not contain only obvious junk foods. So they served many highly processed foods that a typical American might eat daily and potentially even consider nutritious, like Cheerios, blueberry muffins and orange juice for breakfast; cheese and turkey sandwiches with baked Lay’s potato chips and diet lemonade for lunch; and steak, canned corn, mashed potatoes from a packet, and a diet beverage at dinner. On the processed diet, the subjects were also offered snacks like low-fat chips, Pepperidge Farm Goldfish crackers and other packaged foods typically found in vending machines.

The researchers designed the two diets so that they contained roughly equivalent amounts of calories, carbs, fat and sugar. But the subjects were allowed to eat as much as they wanted, and they ended up consuming more calories from the meals when they were given the processed food diet.

And the sources of those macronutrients were very different. On the unprocessed diet, the subjects got their fiber, sugar and carbs from fresh produce, beans, oatmeal, sweet potatoes, grains and other whole foods. On the ultra-processed diet they ate mostly refined carbs and added sugars found in bread, bagels, juices, tater tots, sauces, chips, pasta, French fries and canned foods. The subjects were given fiber supplements on the processed diet because those foods are typically low in fiber.

The subjects spontaneously ate a lot more calories on the processed diet and, not surprisingly, gained weight. On the unprocessed diet, they consumed far fewer calories and lost weight. An analysis of their hormone levels seemed to indicate why: On the unprocessed diet, their levels of the appetite-suppressing hormone PYY increased while levels of ghrelin, a hormone that stimulates hunger, fell.

Dr. Hall and his colleagues are planning follow-up studies to examine why the ultra-processed foods had this effect. He pointed out that one thing many popular diets have in common, whether the diet is low-carb, plant-based, vegan, Paleo or high-protein, is that people who follow them often cut back on ultra-processed foods.

However, Dr. Hall cautioned against demonizing processed foods, because many Americans depend on them: Ultra-processed foods are cheap, convenient and long lasting. The unprocessed diet used in the study, for example, cost 40 percent more than the ultra-processed diet.

“We’re talking about foods that make up more than 50 percent of people’s diets, and they can be very attractive to people who have limited time, money, skills and access to ingredients that they can use to make meals from scratch,” he said. “For people who are working two jobs just to make ends meet and have a family to feed, a frozen pizza looks very good at the end of the day.”

Anahad O’Connor is a staff reporter covering health, science, nutrition and other topics. He is also a bestselling author of consumer health books such as “Never Shower in a Thunderstorm” and “The 10 Things You Need to Eat.”