“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.
Each province will decide where and how marijuana may be sold, and will set prices in conjunction with the federal government.
How much marijuana will cost and how heavily it will be taxed will be influenced by Canada’s experience with tobacco, which is also tightly regulated.
When the country tried to discourage smoking by sharply increasing cigarette taxes, it inadvertently created a growing black market for cigarettes smuggled from the United States and elsewhere.
Since one of the government’s main aims with the new law is to wipe out — or at least reduce — illicit marijuana dealing, it will want to avoid measures that spur its growth.
It is unclear where users will be able to buy the drug. Several provinces restrict alcohol sales mainly to government-run liquor stores, and a similar arrangement may be used for marijuana. But a federal task force that released its findings late last year recommended that marijuana not be offered in shops that also sell alcohol.
One thing seems clear: The illegal marijuana stores that sprang up in several cities after Mr. Trudeau came to power in late 2015, in anticipation of the new law, are not likely to be allowed to stay in business. The shops are supplied by black-market growers or organized criminal groups, and while the police have left them alone in some cities, the authorities have been openly skeptical about assertions by shop owners that they sell only to medical users.
Ontario’s attorney general is seeking a forfeiture order that would allow them to confiscate almost 600,000 Canadian dollars in cash — about $450,000 — that was seized at the Toronto airport from an employee of a chain of seven illegal medical marijuana outlets in the city.
Figuring out how to measure impairment is a priority on the government’s list of things it must do before the legal market is expanded.
Several police forces, including the Royal Canadian Mounted Police, are testing two types of screening devices that can detect drugs — including THC, the main psychoactive substance in marijuana — in saliva.
Proposed amendments to criminal laws would require motorists to give the police saliva samples on request and allow officers to demand a breath test for alcohol when stopping drivers for any reason.
The issue goes beyond motorists. Gilbert Brulotte, the former chairman of the Canadian Construction Association, said the law may lead to increased accident rates on job sites.
Mr. Brulotte acknowledged that marijuana use by construction workers has been a safety problem for a long time. But until now, he said, any evidence of marijuana use was grounds to fire someone. After legalization, employers will need to show that the worker was impaired on the job.
“We are not against legalization; we’re just interested in making sure that thresholds and proper technologies are in place,” Mr. Brulotte said, adding that the industry also wanted the right to perform random drug tests in the workplace.
The legislation would seem to put Canada in violation of three United Nations treaties concerning drugs. But a study released this week by the University of Ottawa Global Strategy Lab found that the government may be able to justify the measure under exemptions for “scientific purposes.”
The promise of the new law has prompted investors to bid up the stocks of 11 licensed medical marijuana growers. Several have tripled or quadrupled in price over the past year.
But while the existing licensed growers — more than 40 in all, including those that are not publicly traded — are expected to have a head start in the recreational market, it is not clear that they will see a boom of the kind that, say, whiskey distillers enjoyed after Prohibition was repealed.
Indeed several of those companies saw their stock prices fall after the bill was introduced. Shares of Canopy Growth, the largest publicly traded producer and the owner of the Tweed medical marijuana brand, were down more than 4 percent by late afternoon.
Mr. Blair said the Canadian system would place public health policy above commercial interests. “It is not our intent to promote the use of this drug,” he said.
Under the new law, marijuana will be marketed more like cigarettes than like liquor. Marketing will be limited largely to providing factual information about the product, like its name, its ingredients and the strain of marijuana used.
The government is considering regulations that would allow only plain packaging to be used, as a bill now in Canada’s Senate will require for cigarettes.
Even so, Brendan Kennedy, the president of Tilray, a medical marijuana producer in Nanaimo, British Columbia, said his company would ask that producers be allowed to develop brands through distinctive packaging. “Otherwise it will be a race to the bottom, as companies will compete only based on potency and price,” he said.
Though many licensed growers appeared to get into the medical marijuana business with an eye toward the eventual opening of the much larger recreational market, Canada’s first legal grower said on Wednesday that the government’s action was premature.
“I think it’s rather aggressive,” said Brent Zettl, the president and chief executive of CanniMed Therapeutics in Saskatoon, Saskatchewan. “I think it’s rather arrogant of Justin Trudeau.”
Mr. Zettl, whose company had the medical marijuana market to itself for several years, said he owed it to his investors to get into recreational marijuana, but he was not certain that it would be very profitable.
And he said he agreed with doctors and police officials who want higher minimum ages to buy the drug: 25 for high-potency products and 21 for reduced potency.
The bill includes stiff new criminal penalties for people who sell or give marijuana to minors, or who create cannabis products that appeal to children or adolescents.
Widespread use of more potent recreational marijuana, Mr. Zettl added, may also undermine efforts to understand the drug’s medicinal effects, particularly for users looking for relief, not a high.
“It’s good from an industry perspective,” Mr. Zettl said of the new law. “I don’t think it’s good for society.”
At the news conference, Mr. Goodale warned that Canada’s new law would apply only in Canada, and cautioned citizens not to take their marijuana out of the country.
John F. Kelly, the United States secretary of homeland security, told the Canadian Broadcasting Corporation in Ottawa last month that he saw no need for new border measures once the law took effect. But he did have a tip: “I would just highly recommend to Canadians to check those pockets one more time.”