TORONTO -- The government of Ontario will give municipalities $40 million dollars from its share of federal marijuana taxes to help cover law enforcement and safety costs associated with pot legalization, the province announced Friday.

The money -- which will be provided to municipalities upfront, beginning before legalization takes effect later this year -- will come from the first two years of federal excise duties on producers of recreational pot.

"This funding will ensure that Ontario's municipalities have dedicated resources for cannabis enforcement," said Marie-France Lalonde, minister of community safety and correctional services. "Ontario will continue working with law enforcement agencies to protect our communities from illegal cannabis activity, and to keep impaired drivers off the road."

The money will be provided to municipalities based on the number of households they have, but will be adjusted so every municipality gets a minimum of $10,000. If Ontario receives more than $100 million from federal marijuana tax over the course of two years, it will give half the surplus to municipalities.

The province will also earn money through the sale of recreational marijuana at provincially-licensed stores and online. The government revealed Friday that its pot-selling agency will be known as the Ontario Cannabis Store.

"The name is designed to convey a safe, simple and approachable environment for consumers, and agency employees, in a clear and easily understood manner," the government said in a statement.

Ontario is also creating a Cannabis Intelligence Co-ordination Centre to help shut down illegal storefront pot dispensaries, paying for training to help police across the province recognize and stop drug-impaired drivers, and assembling a legal team to support the prosecution of drug-impaired drivers.

"We want to ensure Ontarians are protected from the dangers of drug-impaired driving and the sale of illegal, unregulated and potentially unsafe cannabis," said Ontario Attorney General Yasir Naqvi. "That is why it is so important that our municipal and enforcement partners have the tools they need to take down illegal cannabis stores, better detect impaired drivers and prosecute offenders."

The Association of Municipalities of Ontario said it was pleased to see Ontario help local governments with local needs arising from Canada's new marijuana laws.

"Cannabis legalization will impact municipal governments across Ontario," said president Lynn Dollin. "Legalization is new for everyone and both the province and AMO recognize the need to monitor and measure the real costs as implementation unfolds."

The federal government agreed in December to give 75 per cent of its marijuana excise tax revenue to the provinces and territories for two years. One third of the provincial and territorial governments' shares are expected to be given to municipalities.

The federal government's share of the duties is capped at $100 million, with any additional revenue going to provinces and territories. Every province and territory has signed on to the plan except Manitoba, which is holding out for a larger cut of excise revenue.