At the beach and on the boardwalk, seagulls have a bad reputation for swooping down on unsuspecting people to steal their food. But scientists recently discovered there's a simple solution to deter these avian thieves: Stare at them.

Whereas gulls might be tempted to swipe your snack when you're distracted, they're less likely to come near if you pay attention to them, researchers recently reported.

Their experiments demonstrated that gulls were more cautious about approaching a tempting treat if there was a person nearby who was watching them closely. However, the scientists also found that far fewer of the birds than expected showed interest in investigating the food at all when being stared at.

Related: Beastly Feasts: Amazing Photos of Animals and Their Prey

For the study, researchers tested the behavior of herring gulls (Larus argentatus); these large, omnivorous seabirds are found year-round in coastal regions around the United Kingdom, according to the Royal Society for the Protection of Birds (RSPB).

"As an animal behavior enthusiast, I became interested in studying them through observing them in my day-to-day life," said lead study author Madeleine Goumas, a researcher with the Center for Ecology and Conservation at the University of Exeter's Penryn Campus in Cornwall, U.K.

"I noticed that gulls seemed to have a bad reputation for food-snatching, but only saw it happen quite rarely," Goumas told Live Science in an email. "When I did see it happen, gulls often swooped in from behind, and the people were completely oblivious."

Prior studies had shown that some animal species change their behavior in response to the human gaze, and the study authors wondered if that also might be true for the gulls.

Stop and stare

The scientists approached 74 herring gulls in coastal towns in Cornwall, tempting them with weighted bags of fried potatoes. Most of the birds promptly flew away. Only 19 gulls were curious or hungry enough to linger, allowing the scientists to place the bag on the ground and retreat a short distance away, waiting in a crouched position to see if a gull would approach.

"By far, the biggest challenge was gulls being scared off by people or their dogs, as we were conducting these experiments in urban areas that weren't free of passersby," Goumas said.

Whenever a bird showed interest in the food bag, a researcher would either ignore the gull or stare at it intently. Both trials would continue until the bird either pecked at the food bag or 300 seconds elapsed with no approach.

During the tests in which the researchers looked away, all of the gulls touched the food. Gulls took "significantly longer" — about 21 seconds more, on average — to touch the food if they were being watched, and six of the watched gulls wouldn't tap at the food at all, the researchers reported.

But there was also a lot of variation in the gulls' responses; some approached more slowly than others, while others appeared not to notice the researchers' stares. Overall, the gulls' behavior suggested that they would be more likely to stay away from food if humans were close to the birds, the authors wrote.

Most people find it hard to distinguish between individual gulls; therefore, even if only a few gulls in a seaside town's population are stealing human food, beachgoers may jump to the conclusion that all gulls do it, Goumas said in the email.

In fact, people may be able to protect their lunches from gulls by avoiding areas where the birds tend to gather and keeping a closer eye on their meals, she added.

"Gulls have a bad reputation but, like all animals, they are just trying to survive," Goumas said. "We can try to alleviate the conflict we have with them by making changes in our own behavior."

The findings were published online Aug. 7 in the journal Biology Letters.

Originally published on Live Science.

Follow NBC News MACH on Twitter and Facebook and Instagram.