Russell Burden / Getty Images

Marijuana does not impair lung function—at least not in the doses inhaled by the majority of users, according to the largest and longest study ever to consider the issue, which was published today in the Journal of the American Medical Association.

Researchers working on a long-term study of risk factors for cardiovascular disease (the Coronary Artery Risk Development in Young Adults or CARDIA study) tested the lung function of 5115 young adults over the course of 20 years, starting in 1985 when they were aged 18 to 30.

They found that marijuana use was almost as common as cigarette smoking in the sample, which was designed to reflect the U.S. population. Among participants, the average marijuana user toked 2-3 times a month, while the average tobacco user smoked eight cigarettes a day. Those who smoked both tended to do so slightly more frequently than those who smoked only cigarettes or only marijuana.

The study was “well conducted” and is “essentially confirmatory of the findings from several previous studies that have examined the association between marijuana smoking and lung function,” says Dr. Donald Tashkin, professor of medicine at UCLA and a leading scientist in the area. He was not associated with the new research.

“The major strengths of this study are that it included a far larger number of subjects followed for longer than any of these previous studies,” he adds.

MORE: Teen Drug Use: Marijuana Up, Cigarettes and Alcohol Down

While tobacco smokers showed the expected drop in lung function over time, the new research found that marijuana smoke had unexpected and apparently positive effects. Low to moderate users actually showed increased lung capacity compared to nonsmokers on two tests, known as FEV1 and FVC. FEV1 is the amount of air someone breathes out in the first second after taking the deepest possible breath; FVC is the total volume of air exhaled after the deepest inhalation.

“FEV1 and FVC both actually increased with moderate and occasional use of marijuana,” says Dr. Mark Pletcher, associate professor of epidemiology and biostatistics at the University of California, San Francisco and the lead author of the study.

That was a bit of a surprise, says Pletcher, since “There are clearly adverse effects from tobacco use and marijuana smoke has a lot of the same constituents as tobacco smoke does so we thought it might have some of the same harmful effects. It’s a weird effect to see and we couldn’t make it go away,” he adds, explaining that the researchers used statistical models to look for errors or other factors that could explain the apparent benefit and did not find them.

MORE: Marijuana Slims? Why Pot Smokers Are Less Obese

The improvement wasn’t seen in the heaviest users, however. At high levels of marijuana use—for example, in those who smoked more than 20 times a month—FEV1 slipped back to levels seen in nonusers and a reduction was seen in, um, the most chronic smokers. But FVC remained high in even the longest term, heaviest users.

So why might marijuana users have greater lung capacity than nonsmokers? Consider Bill Clinton’s famous non-denial denial of his marijuana use, “I didn’t inhale” and Barack Obama’s retort that he “inhaled frequently; that was the point.” Unlike cigarette smokers, cannabis users usually draw deeply on the joint or pipe— and hold each puff in, typically for as long as physically possible.

“In some ways, marijuana smoking is really a lot like doing a pulmonary function test,” Pletcher says. This “practice” or “exercise” might expand lung capacity and account for the unusual results.

He cautions, however, that long term exposure to marijuana smoke at the most extreme doses probably does damage the lungs, although he concedes that the evidence from the study on this point is “weak.”

The authors conclude:

Marijuana may have beneficial effects on pain control, appetite, mood, and management of other chronic symptoms. Our findings suggest that occasional use of marijuana for these or other purposes may not be associated with adverse consequences on pulmonary function. It is more difficult to estimate the potential effects of regular heavy use, because this pattern of use is relatively rare in our study sample; however, our findings do suggest an accelerated decline in pulmonary function with heavy use and a resulting need for caution and moderation when marijuana use is considered.

Since the study focused on cardiovascular disease and even the oldest participants had not yet reached the highest risk ages for lung cancer, it does not provide new information on cancer risk, but it does confirm the link between cigarette smoking and long-term lung function declines.

Tashkin, however, has studied this issue extensively. He says, “The largest epidemiologic (case-control) study of the association between marijuana use and lung cancer failed to demonstrate that marijuana increases the risk of developing lung (or, for that matter, upper airway) cancer.”

He notes that a much smaller, recent study from New Zealand did claim to find a link, but only in very heavy users. He says, “The authors’ interpretation of their data can be faulted because of the small numbers of their subjects exhibiting such heavy use, which rendered their estimates of risk imprecise.”

Why smoking marijuana and smoking tobacco should have such different effects on the lungs is still a matter of dispute. Many researchers believe that it’s simply a matter of dose: most marijuana users smoke a few times a month, while most cigarette smokers light up multiple times a day.

But Tashkin argues that specific properties of marijuana also matter. He says that THC has anti-inflammatory and immune suppressing properties, which may prevent lung irritation from developing into chronic obstructive pulmonary disease (COPD), a devastating lung disorder frequently caused by tobacco smoking.

As for cancer, he says, “the THC in marijuana has well-defined anti-tumoral effects that have been shown to inhibit the growth of a variety of cancers in animal models and tissue culture systems, thus counteracting the potentially tumorigenic effects of the procarcinogens in marijuana smoke.”

Whatever the cause, it seems that those who argue that marijuana is harmful because of its smoke are going to have to find a different line of attack.

MORE: U.S. Rules That Marijuana Has No Medical Use. What Does Science Say?

Maia Szalavitz is a health writer at TIME.com. Find her on Twitter at @maiasz. You can also continue the discussion on TIME Healthland’s Facebook page and on Twitter at @TIMEHealthland.