WALNUT CREEK — City leaders on Tuesday night approved an ordinance regulating personal cultivation of both recreational and medicinal marijuana and allowing local commercial delivery of medical cannabis.

The council’s 5-0 vote, which drew applause from the audience, follows 18 months of deliberate discussion in its response to the November 2016 passage of state Proposition 64, which as of Jan.1, 2017, made recreational marijuana for adults 21 and older legal.

Prop. 64 allows individuals to grow as many as six plants inside their homes, and cities can’t alter that. However, cities have considerable leeway in regulating growing and selling marijuana, and some cities have banned outdoor grows altogether.

Walnut Creek’s Personal and Commercial Cannabis Activities Ordinance allows for establishment of one or two medical marijuana delivery-only businesses within Walnut Creek, located 1,000 feet or more from schools, churches or city parks. Residents of single-family houses can grow up to six plants in the back yard, set back from property boundary fences. For rental units, the landlord could stipulate whether growing pot is allowed.

Council members said Tuesday’s vote “is a good step forward” in helping sick people obtain medicine that eases pain, aids sleep and appetite and helps them stay off of opioids.

“It’s a matter of giving (patients) an option that is safe,” said Mayor Justin Wedel, adding that he personally preferred making medical marijuana even more readily available. Other council members said this relatively conservative ordinance could be revisited in the future, depending on how well this version works out.

More than a dozen medical marijuana advocates urged the council to approve this ordinance, or one that allowed for brick-and-mortar vendors in the city. The new ordinance, which takes effect in 60 days, outlaws any brick-and-mortar commercial operations, commercial cultivation and testing of recreational marijuana.

“I don’t understand why (medical marijuana) is so controversial, especially for older folks who don’t have to use opioids and others meds,” said Diana O’Byrne, a Rossmoor resident.

Renee Lee, the co-founder and president of the Rossmoor Medical Marijuana Club, told the council that seniors need more availability than the new ordinance provides. “Thanks for doing this, but it’s a band-aid,” she said. “We need the tax dollars here, and the black market out.”

Walnut Creek has been more deliberate than many East Bay cities in its response to the November 2016 passage of state Proposition 64, which as of Jan.1, 2017 made recreational marijuana for adults 21 and older legal. While thus far not allowing storefronts selling medical or recreational pot, allowing home delivery of medical cannabis is more than some neighboring towns, including San Ramon and Danville, allow.

A survey taken by the city showed that 61 percent of Walnut Creek voters last November said “yes” to Prop. 64. Many in Tuesday’s audience reminded the council of that, but Councilman Kevin Wilk said it isn’t that simple. He knows thousands of local residents don’t want any added access to marijuana in their city.

“I think we’ve reached a good balance on this,” Wilk said.

California cities must adopt either a permanent ban or regulations of cannabis use, sales and cultivation before March 1, 2019, after which date the state can issue cannabis licenses without a city’s input.

Reach Sam Richards at saaaam@att.net. Follow him on Twitter at @samrichardswc