Researchers said Tuesday that results of a two decade study have found moderate use of marijuana is less harmful than exposure to tobacco smoke.

Researchers from the University of California, San Francisco and the University of Alabama at Birmingham measured air flow rate and lung volume in more than 5,000 U.S. adults over 21 years, and were surprised to find increased air flow with increased exposure to marijuana up to a certain level.

“We found exactly what we thought we would find in relation to tobacco exposure: a consistent loss of lung function with increasing exposure,” said the paper’s lead author, Mark Pletcher, MD, MPH, associate professor in the Division of Clinical Epidemiology at UCSF. “We were, however, surprised that we found such a different pattern of association with marijuana exposure.”

Participants in the study began as young, healthy adults 18 to 30 years old from Oakland, Chicago, Minneapolis and Birmingham.

Researchers note that the results can supplement the growing body of knowledge about beneficial aspects of low to moderate marijuana use in controlling pain, stimulating appetite, elevating mood and managing other chronic symptoms.

The study, supported by funds from the National Heart Lung Blood Institute, is published in the Journal of the American Medical Association.