In anticipation of legal marijuana being sold across Canada later this year, a wealthy Quebec municipality has banned smoking in all public spaces.

The mayor of Hampstead, Que., a tiny but affluent community of about 7,000 people that lies within Montreal, says the new bylaw is designed to prevent second-hand smoke, diminish skunky fumes and avoid setting a “bad example” for youth.

The rule outlaws smoking anywhere outside of a private residence or vehicle. Hampstead city council accepted the bylaw Monday in a vote of five to two.

According to the Canadian Cancer Society, Hampstead is the first municipality in Canada to ban public smoking outright.

William Steinberg, mayor of Hampstead, said the Liberal government’s looming cannabis legislation – which could legalize cannabis as soon as this summer – prompted the vote.

“Our town is all residential, nobody will be selling anything in our town, but we don’t want people wandering the streets smoking joints,” Steinberg told CTV News Channel on Tuesday.

“We don’t want the smell, we don’t want the second-hand smoke, and we most certainly don’t want to set a bad example for young people so they will take it up.”

The new rule covers cannabis and tobacco but does not ban electronic cigarettes. Anyone who breaks the bylaw can face a ticket between $250 and $1,500, a fine the mayor says was based on similar penalties set by the province.

Under the new bylaw, a person would be unable to smoke in Hampstead’s parks, streets or while strolling down the sidewalk.

Steinberg said that if someone wants to have a cigarette while walking their dog, they can do so outside of Hampstead’s borders. The community is only a few blocks wide, and is surrounded by Montreal.

“You can go walk your dog outside our community. It’s, like, a block or two for most people and they’ll be in Montreal or they’ll be in Cote-Saint-Luc. They really don’t have to smoke in Hampstead,” he said.

A public safety officer will be tasked with enforcing the smoking embargo. The mayor says that since the rule is new, the officer will “politely” inform smokers of the change and ask them to stop.

“If the person complies, that’s the end of it. Our goal isn’t to give tickets. Our goal is to have a smoke-free environment. And obviously if people refuse, then they get tickets.”

The bylaw is expected to take effect in the next week.

With files from The Canadian Press