Men donate more generously when fundraising campaigns feature attractive women, and when they feel they are competing against other men, according to a new study. The authors say their findings point to an evolutionary link between male generosity and sexual selection.

Scientists aren’t sure why people donate at all. From an evolutionary standpoint, humans aren’t built for unconditional generosity—in theory, we shouldn’t give up something that belongs to us, unless we stand to gain from the transaction. Prior studies have shown that generous populations tend to live longer, but they failed to explain exactly why altruistic populations outlast stingier ones.

This new study suggests that men donate as a way of signaling to potential mates that they are more generous, and wealthier, than other men. Researchers reviewed 2,561 fundraising pages from the 2014 London Marathon and found that, on average, men donated about £28 ($42) more than usual when the fundraiser was for an attractive female (judged as attractive by an independent group of men), and when they could see that other men had also donated. The authors found no such correlation among female donors.

“It’s kind of the equivalent of a peacock’s tail, but using generosity instead of a showy tail to attract partners,” says Nichola Raihani, a behavioral scientist at University College London and coauthor on the study. “By being visibly generous, individuals signal to potential mates that they have resources, like money, and that they are willing to share these resources.”

Read More:

The Importance of Being Marginal: Gender Differences In Generosity (National Bureau of Economic Research)