What kind of man is most attractive to a woman looking for a short-term fling or one-night stand? Men with light stubble won that contest, closely followed by men with heavier stubble, suggesting that the scruffy look appeals to women looking for fun, but not commitment.

But when it came to choosing a long-term partner, a guy with whom a woman could have babies or settle in for the duration, the more facial hair the better. Men with heavy stubble and full beards were the clear winners on this question, suggesting that men who are ready to commit might do better if they shave less often.

The authors of the study theorize that for women who are looking for a long-term mate, beardedness may be more attractive as it “indicates a male’s ability to compete for resources.”

Barnaby Dixson, a human behavioral ecologist at the University of Queensland and a co-author of the beard length study, has been researching mate preferences for a decade. He explains that both sexes judge men with beards as older and more masculine, and describe them as generous, sincere, industrious and self-confident.

But Dr. Dixson, who sports a full beard, says research has also found that facial hair is associated with some antisocial traits, such as aggression and social dominance. While these traits might not be pleasant if you’re looking for a fun fling, they might be alluring if you want an alpha male to support your family and fend off predators.

It’s not just women who prefer bearded alpha males — men also prefer men with facial hair.

Dr. Dixson and colleagues asked 1,577 men and women from Brazil and the Czech Republic about facial hair. Compared to heterosexual women, gay men had stronger preferences for men with more facial hair.

“Homosexual men preferred hairier stimuli than heterosexual women, supporting past findings that homosexual men have strong preferences for masculine traits,” the authors reported.