Drinking diet soda may go hand in hand with indulging in extra helpings of sugar- and fat-laden foods like cookies or french fries, a new study suggests.

Researchers found that on the days that the people in the study drank diet or sugar-free drinks, they consumed about 49 more calories from high-calorie, nutrient-poor foods — such as ice cream, cookies, pastries and fries — compared with the days the individuals did not drink diet beverages. Scientists call such foods discretionary foods, because the human body does not need them to function.

For comparison, on the days people drank regular sugary beverages, such as regular sodas and fruit drinks, the individuals consumed about 30 extra calories from discretionary foods, the study found.

"The key finding is that on the days when people drank diet beverages, they consumed a higher proportion of discretionary foods compared to on the days that they did not drink diet beverages," study author Ruopeng An, an assistant professor of kinesiology and community health at the University of Illinois at Urbana-Champaign, told Live Science. [5 Experts Answer: Is Diet Soda Bad for You?]

In the study, the researchers asked 22,000 U.S. adults what they ate and drank over the course of two nonconsecutive days. More than 90 percent of the people in the study said they had consumed discretionary foods on both days. An average of 482 calories per day came from these foods.

People consumed the fewest calories from discretionary foods on the days when they did not drink any type of sweetened beverage, the researchers said.

Among the obese people in the study, drinking diet beverages was linked with consuming even more additional calories than nonobese people from discretionary foods, the researchers found. The obese people consumed an average of 73 extra calories from discretionary foods on days they drank diet drinks, compared with the days they didn't have these drinks. For comparison, on the days they consumed regular sugary beverages, obese people consumed 32 extra discretionary-food calories.

It is not clear why exactly diet drinks may be linked to an increased intake of calories from unhealthy foods, An said. It is possible that people do not feel satiated after consuming diet beverages, so they compensate by eating more discretionary foods, he said.

Or, it could be that people feel less guilty about consuming more calories after drinking a diet beverage, and therefore they feel justified in eating muffins or chips, An added.

But there is also a third possibility that may explain the link: Perhaps people indulge in unhealthy foods first, and then they choose to consume diet beverages because they feel guilty about eating the foods, An said.

The new study was published Friday (Sept. 11) in the Journal of the Academy of Nutrition and Dietetics.

Copyright 2015 LiveScience, a Purch company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.