“We do accept that important work remains to be done,” he said.

While the federal government will license and regulate growers, each of Canada’s provinces will need to decide exactly how the drug will be distributed and sold within its boundaries. The government will have to develop the marijuana equivalents of breathalyzers so that drivers can be checked for impairment at the roadside and workers can be tested for safety on the job. Diplomats will have to address conflicts with international drug treaties. And many in the medical field are concerned about the long-term health effects of increased use of marijuana by Canadians under the age of 25.

Though eight American states have legalized marijuana to various extents, the drug remains illegal under federal law. Mr. Trudeau’s move eliminates any such ambiguity in Canada. It follows a court-mandated legalization of marijuana for medical purposes, which was introduced with tight controls in 1999 and later broadened by further court orders.

While the new legislation will take Canada beyond its medical marijuana system, it stops far short of creating an open market. The law will require purchasers to be at least 18 years old — though provinces can set a higher minimum — and it will limit the amount they can carry at any one time to 30 grams, about an ounce.

Households will be allowed to grow up to four marijuana plants. But the legislation seems built on the assumption that most users will be supplied by commercial growers, who will be licensed and closely supervised by the federal government.

Growing, importing, exporting or selling marijuana outside licensed channels will remain serious crimes, according to Mr. Blair and Ralph Goodale, the public safety minister.