Denver has prohibited medical marijuana dispensaries from advertising their wares on billboards, bus-stop benches, handbills and other outdoor signs, just 2 1/2 months before Colorado votes on legalizing the drug for recreational use.

The ordinance, passed unanimously by City Council late on Monday, bans all outdoor advertising by the city's 400 medical pot shops, but allows ads in print publications and online sites, although they must contain a disclaimer noting that cannabis products are for medical use only.

Colorado's November ballot measure would legalize up to an ounce (28 grams) of marijuana for recreational use, despite a federal ban on the drug. Oregon and Washington state are voting on similar measures.

Federal law enforcement under the Obama administration has cracked down on dispensaries in several Western states that allow medical pot operations.

Deborah Ortega, an at-large councilwoman who sponsored the law, said she had explored crafting an ordinance banning outdoor advertising within 1,000 feet of schools, parks and daycare centers, but decided on the outright ban.

"The intent was to protect kids," Ortega told Reuters on Tuesday.

Colorado is one of 16 states along with the District of Columbia that allows the use of medical marijuana.

Michael Elliott, executive director of the Medical Marijuana Industry Group, said his organization helped craft the ordinance, and that it would help legitimize medical marijuana businesses.

"We believe this (law) strikes the right balance between the city's concerns and the medical marijuana community," he said.

But Kristen Thomson, spokeswoman for the Cannabis Business Alliance, said her group opposed the ordinance because of its "far-reaching" implications.

An earlier version of the law that would have barred dispensaries from advertising at charitable events was ultimately removed, she said.

"While we're not happy about the outcome, at least now there is some clarification and clear guidelines," Thomson said.

Colorado's ballot measure, if approved, would regulate the sale of cannabis products and apply excise and sales taxes much like the regulatory framework in place for the sale of alcohol.

The proposal also would allow the cultivation of industrial hemp for various products.

Earlier this year, federal prosecutors in Denver ordered 37 medical marijuana dispensaries in the state to close or face criminal penalties because they operated too close to schools.