Ask anyone whom they prefer to work with, nice guys or bullies, and you’ll get a fast and certain reply — just about everyone says they prefer to share an office with kindhearted do-gooders.

That’s what people say, anyway.

But if you’ve ever been the office sweetheart, you know that what people claim to want and how they actually behave can be completely at odds. While everyone praises kindness and cooperation, exceptionally nice people often find their good deeds met with nastiness, ridicule, exploitation, and backstabbing. Why is that?

You could conclude (not entirely without foundation) that humans are sometimes nasty, hypocritical creatures, but according to a recent Canadian study the reason our stated ideals and our real-life actions fail to match up is more complicated than that. Niceness, the research found, can actually come across as threatening.

The office superman makes everyone else look bad

We all flock to superhero movies to see good guys triumph and bad guys get what’s coming to them. But when Superman saves the day onscreen, there’s no reason for the average bystander to feel bad about not stopping that runaway train. Mere mortals aren’t expected to have superstrengths, after all.

Things are different at work when a real-life person starts playing the role of superhero, psychology professor Pat Barclay and his collaborators discovered when they brought study subjects into the lab to play a series of economic games. Exceptionally generous and hard-working colleagues make those around them look bad in comparison. Their superkindness and productivity challenge other employees to perform at the same level, and that can stir up nasty reactions, the researchers found.

“Most of the time, we like the cooperators, the good guys,” Barclay commented, but when people find themselves in competitive environments such as many offices have, the script flips. “People will hate on the really good guys. This pattern has been found in every culture in which it has been looked at.” In particularly tough environments, people will attack an exceptional sweetie even if doing so harms the group as a whole.

How to fight back against the anti-do-gooder effect

While Barclay’s research wasn’t designed to suggest real-world strategies for those impacted by this nasty human tendency to punish the exceptionally nice, when I emailed him he was happy to offer advice.

“It might help to turn the tables on the criticizers: Point out that they’re just attacking to prevent themselves from looking bad” was his first suggestion. But the best solution may be even more straightforward: Don’t put yourself in situations where you have to work with terrible people.

“Perhaps the best solution is to just find better associates. If you’re being criticized for being too nice or for working too hard, then go find others who are just as nice and hard working as you. When cooperative people work with one another, they end up much better off than their critics,” Barclay sensibly advises.

Whatever your response to the haters, at least this study proves you’re not going insane. There is a real, scientifically validated reason that being extra good can sometimes bring out the worst in people. That shouldn’t stop you from being your sweetheart self, but it should make you more careful about whom you spend your kindness on.