When Michael Eisenberg, MD, talks to his patients about sex, they sometimes ask him whether marijuana might affect their libido or their performance. “Use of the drug is increasing as it becomes legal in more states, and some men—as well as some doctors—worry that it could cause erectile dysfunction other sexual problems,” he says.

So Dr. Eisenberg, an assistant professor of urology at Stanford University School of Medicine, and his colleagues conducted a study to see if there really was a connection. They found reassuring news for those patients: Overall, regular marijuana use does not seem to impair sexual desire or performance. In fact, people who smoke marijuana tend to have more sex than those who don’t.

The new study, published today in the Journal of Sexual Medicine, is based on surveys of more than 50,000 Americans ages 25 to 45, collected between 2002 and 2015. As part of a larger health questionnaire, participants reported how often they’d smoked marijuana during the past 12 months and how often they’d had intercourse with someone of the opposite sex during the past four weeks.

Dr. Eisenberg and his colleagues crunched the numbers, and found that the more frequently people smoked marijuana, the more sex they had. For both men and women, those who used marijuana on a daily basis had about 20% more sex than those who said they never used the drug.

Women who abstained had sex an average of 6 times over the past four weeks, compared to 7.1 times for daily users. For men, abstainers averaged 5.6 times and daily users averaged 6.9.

The authors point out that the study was not able to find a cause-and-effect relationship between pot and sex. “We don’t want people to start smoking marijuana because they think they’re going to have more sex,” says Dr. Eisenberg. “It’s certainly possible that people who use marijuana happen to have similar traits, like lower inhibitions, as those who also have more sex.”

But the link was seen across all subgroups in the study—including people of both genders; different races, ages, and religions; those who were married or single; and with kids or without. The link also remained after the researchers adjusted for use of other drugs, such as cocaine and alcohol. This suggests that there may be something about the drug itself that boosts sexual function, says Dr. Eisenberg—or at the very least, doesn’t hamper it.

Overall, about 25% of men and 15% of women in the survey reported having used marijuana. According to the National Institute on Drug Abuse, more than 20 million Americans are current marijuana users, and the drug is legalized for medical or recreational use in 29 states.

If marijuana does, in fact, increase people’s desire for sex, it may have to do with the fact that cannabinoid receptors in the brain—which are activated by the drug—are known to be active during sexual activity, the authors write in their paper.

But Dr. Eisenberg says that marijuana’s effects on sexual function likely vary from person to person. In their paper, the authors cite a 2003 review of studies in which 51% of marijuana users reported increased sexual arousal while 26% reported a decrease. (In those same studies, however, 74% of people said they believed marijuana increased sexual pleasure.)

They also cite research suggesting that small amounts of marijuana can enhance sexual function, while larger quantities can inhibit it. And they point out that their new study only asked how often people had sex—not how good it was. More research is needed, they say, to determine marijuana’s effects on things like erectile function, orgasm frequency, vaginal lubrication, and fertility.

As a physician, Dr. Eisenberg says there are other reasons doctors may discourage marijuana smoking—like its harmful effects on the lungs. But he says it’s helpful to know that, in general, it’s probably not also a direct cause of sexual problems.

“Say I have a patient who smokes marijuana and is 40 pounds overweight, and he complains about his sexual performance,” Dr. Eisenberg says. “This study suggests that focusing on the marijuana use probably isn’t going to be as helpful as focusing on other possible strategies, like weight loss.”