In a new study, scientists examined a survey database of 22,086 healthy subjects between the ages of 40 and 75, including 17.7 percent who reported new onset of erectile dysfunction between 1986 and 2000.

Physical activity (beyond mere sex) played a key role in helping men avoid the dreaded ED, as clinical researchers fondly call the condition.

“We found a 2.5-fold difference in risk of ED when we compared obese men who did little exercise with men who were not overweight and averaged 30 minutes of vigorous exercise a day," said Eric Rimm , associate professor of epidemiology and nutrition at the Harvard School of Public Health.

Smoking, too, was associated with a higher risk of getting ED among men who previously had good erectile function.

The same bad habits up the odds of getting heart disease, the researchers point out. And in fact a study earlier this year in the Archives of Internal Medicine found that ED was a warning sign for heart disease.

But perhaps the idea of missing out on sex can serve as a more compelling health warning.

“Many men may choose not to change to a healthier lifestyle, which includes exercise and a prudent diet, because they perceive heart disease as something that may only develop decades in the future," Rimm said. "Hopefully, these results will help to motivate men to adopt a more active lifestyle to avoid a problem which may be more immediate."

The study, detailed in the July issue of the Journal of Urology, was supported by Pfizer, Inc., and by grants from the National Institutes of Health. It confirms research published in the Journal of the American Medical Association in 2004, which suggested that obese men with ED could improve their sexual function with exercise and weight loss.

Rob was a writer and editor at Space.com starting in 1999. He served as managing editor of Live Science at its launch in 2004. He is now Chief Content Officer overseeing media properties for the sites’ parent company, Purch. Prior to joining the company, Rob was an editor at The Star-Ledger in New Jersey, and in 1998 he was founder and editor of the science news website ExploreZone. He has a journalism degree from Humboldt State University in California.