A fan cooks at MetLife Stadium before an NFL football game between the New York Giants and the New England Patriots last fall. When your team wins, you eat better. (Gary Hershorn/AP)

By the time the Super Bowl is over Sunday night, you may have munched on a few too many nachos and chicken wings, and you might be almost as sick of cheap beer as you are of expensive TV ads.

But if you’re a fan of the Denver Broncos or the Carolina Panthers, the game’s effect on what you eat could linger into Monday, too. Our research has found that people eat worse than they normally do on the day after their football team loses, and better than usual on the day after their team wins. They eat even more junk food if their team loses a close game.

Sports fans, after all, identify with their team in deeply emotional ways. Being a fan fosters a sense of belonging, a connection to a community. If the team wins, fans exult, “We won!” and bask in reflected glory and prestige. But that emotional impact can also work in reverse. Studies have found that cardiac incidents increase after losses. Fans also tend to lose their ability to control themselves, with increases in alcohol-related criminality, traffic fatalities and even domestic violence following major defeats.

Our own study, published in the journal Psychological Science, focused on the effect of football wins and losses on what people eat. We analyzed the daily food consumption of a representative panel of about 700 U.S. households during two seasons of the National Football League. Data on food consumption was collected by NPD Food World, a market research company, from a rolling panel of Americans (mean age 38, 52 percent female) living in major U.S. metropolitan areas. Panel members were asked to keep diaries of their daily food consumption for two periods of 14 days separated by one year. Because we did not have information about what team participants rooted for, we simply assumed that they supported the major team in their metropolitan area. We then looked at what, and how much, people ate on the Monday following a Sunday game and compared it with what they normally ate. We also noted what they ate on Sundays and Tuesdays to establish a baseline. As control groups, we looked at people living in cities without NFL teams and people living in cities whose teams didn’t play that Sunday.

We found that, on the Monday after a Sunday loss, people consumed 10 percent more calories and 16 percent more saturated fat than normal. Saturated fat is typically found in junk food and heavily processed foods. The unhealthy impact of defeats was particularly strong in cities with die-hard NFL fan bases such as Green Bay, Philadelphia and Pittsburgh. In eight cities with the most devoted fans, saturated fat consumption increased by 28 percent following defeats (vs. 9 percent in other cities). People also ate worse when the defeat was by a close score. In other words, unhealthy food was particularly popular in the disheartening instances when “we” almost won — but lost.

Victories had the opposite effect. After a win, people ate 5 percent fewer calories and 9 percent less saturated fat than normal. In the most football-crazed cities, saturated fat consumption decreased by 16 percent after victories (vs. 4 percent elsewhere).

That’s no surprise: When our team wins, we feel better about ourselves. And it is easier to make healthier decisions when we feel good about ourselves. (To be clear, our research didn’t show that rooting for a bad team will make you fat — we studied only a few eating decisions and did not track weight gain over time.)

So what can supporters of whichever team loses Sunday night — or of the 30 other teams that didn’t make it to the Super Bowl — do to prevent the disappointment from spoiling their diets? No real fan will start rooting for another team for health reasons, obviously. Instead, the solution is to redefine ourselves.

If you are a truly devoted fan, the team is part of your personal and social identity, and a defeat feels like a threat to your sense of self. “We lost” can become, over time, “I am a loser,” which makes resisting food temptation more difficult. One of the most effective ways to protect the self against identity threats is to affirm your core values. Simply put, this “self-affirmation” consists of reminding yourself that being a fan is not 100 percent of your identity and that there are other important things that you care about and that define you, such as family, friends or work.

We demonstrated the effect of self-affirmation in a second study. This time, we looked at what 157 French soccer fans felt like eating after watching video excerpts from the national team’s victory over Italy in the 2000 European championship final and from its loss, also against Italy, in the 2006 World Cup final. Just like the Americans, the French chose less-healthy foods after seeing the defeat and healthier foods after watching the victory. So much for the supposed culinary sophistication of French people!

After they watched the clips, though, we gave some of these participants the opportunity to “self-affirm.” We asked them to rank a list of eight self-defining values (such as relationships, family and religion) in order of importance and to explain why their top-ranked value was so important to them. A simple reminder that being a fan was just one aspect of their identity completely inoculated them against the effects of seeing their team lose. When asked what they would like to eat, those watching the defeat became as likely to choose healthy foods as a control group of like-minded fans who had been asked to view a great — but not identity-threatening — game between two Belgian teams. (Of course, this exercise could boomerang if it makes you realize that your team means more to you than the rest of your identity does.)

What all this research tells us: Our eating decisions, like so much else in our lives, are a lot less under our control than we like to believe. Emotions, norms and, more generally, what is going on in our environment play a much larger part in what we choose to eat than just hunger. Remember this the next time you are rooting for a sports team — or, in this season of caucuses and primaries, a political candidate. And be prepared to remind yourself of your core values to prevent the effects of the inevitable setback.

Twitter: @pierrechandon

Read more from Outlook and follow our updates on Facebook and Twitter.