Denver voters on Tuesday approved a ballot measure to become the first U.S. city to decriminalize psilocybin.

The citizen initiative was behind in early election results Tuesday evening and into the next morning but passed on Wednesday afternoon by a slim margin of 50.56% in favor and 49.44% against.

The numbers are still unofficial until the state certifies the municipal election results on May 16.

Initiative 301 decriminalizes the use or possession of psilocybin, the psychoactive substance in “magic mushrooms,” by people 21 and older. It directs police and prosecutors to make enforcement of laws against psilocybin possession their lowest priority. It will still be illegal to sell psilocybin in Denver, as it is in the rest of Colorado.

Denver Mayor Michael Hancock and District Attorney Beth McCann both opposed the measure.

The initiative followed the approach Denver activists took toward decriminalizing marijuana possession in 2005, before Colorado’s Amendment 64 legalized the possession and sale of cannabis in 2012.

Organizers of the psilocybin initiative said their primary goal was to prevent Denver residents from being jailed for using or possessing a substance some use to mitigate depression, anxiety, post-traumatic stress and other conditions.

“No one should go to jail, lose their children, lose their job, and lose their citizen’s rights for using a mushroom,” the Decriminalize Denver campaign states on its website.

The federal government classifies psilocybin as a Schedule I drug, which means it’s legally considered to have no medical purpose and a high potential for abuse. The substance has been outlawed in the U.S. since the 1960s.

That classification has impeded research into psilocybin’s medical uses. But some studies in recent years, including one published last year by researchers at Johns Hopkins University, have found that it can help treat anxiety and depression in cancer patients.

The U.S. Food and Drug Administration last year granted “breakthrough therapy” status to allow further research into psilocybin for treating depression. A breakthrough therapy designation is a process designed to expedite the review and development of a drug after preliminary evidence shows it “may demonstrate substantial improvement over available therapy.”

An effort in California to decriminalize psilocybin failed to qualify for the 2018 ballot. Oregon may put a similar initiative on the statewide ballot next year.