Canada has become the first wealthy nation in the world to fully legalize marijuana.

The Senate approved Bill C-45, also known as the Cannabis Act, on Tuesday. The measure was already approved by the House of Commons, so the Senate’s approval means it’s now set to become law.

The measure legalizes marijuana possession, home growing, and sales for adults. The federal government will oversee remaining criminal sanctions (for, say, selling to minors) and the licensing of producers, while provincial governments will manage sales, distribution, and related regulations — as such, provinces will be able to impose tougher rules, such as raising the minimum age. The statute largely follows recommendations made by a federal task force on marijuana legalization.

The law will go into effect on October 17, with at least some sales beginning on that date, Prime Minister Justin Trudeau said.

None of this may seem too shocking in the US, where already nine states have legalized marijuana for recreational use and 29 states have allowed it for medicinal purposes. What sets Canada apart, though, is it’s doing this as a country. Previously, the South American nation of Uruguay was the only one that legally allowed marijuana for recreational purposes.

Canada, like the US, is part of international drug treaties that explicitly ban legalizing marijuana. Although activists have been pushing to change these treaties for years, they have failed so far — and that means Canada will be, in effect, in violation of international law in moving to legalize. (The US argues it’s still in accordance with the treaties because federal law still technically prohibits cannabis, even though some states have legalized it.)

For Canada’s ruling party, this fulfills a major campaign promise. When Trudeau’s Liberal Party was elected in 2015, one of the main promises he ran on was to legalize marijuana.

“We will legalize, regulate, and restrict access to marijuana,” the Liberal Party declared on its campaign website. “Canada’s current system of marijuana prohibition does not work. It does not prevent young people from using marijuana and too many Canadians end up with criminal records for possessing small amounts of the drug.”

But the process languished as Trudeau and his allies waited for a federal task force’s recommendations and as the Senate debated several provisions in the bill.

In moving forward, the Canadian government is now walking a fine line: It’s hoping to legalize marijuana to clamp down on the black market for cannabis and provide a safe outlet for adults, but it’s risking making pot more accessible to kids and people with drug use disorders. It is taking a bold step against outdated international drug laws, but it could upset countries like Russia, China, and even the US that have historically adopted a stricter view of the treaties. And while Canadian lawmakers may feel marijuana legalization is right for their country, there’s a risk that legal Canadian pot will spill over to the US — perhaps causing tensions with Canada’s neighbor and one of its closest allies.

Whether Canada is successful in its legalization attempts will depend on how it strikes a balance between these concerns. And depending on how it pulls this off, it may provide a model to other countries interested in legalization — including the US.

The risks and benefits of legalization

For Canada, marijuana legalization has been a balancing act from the start.

On one hand, marijuana prohibition has a lot of costs. In Canada, tens of thousands of people are arrested for marijuana offenses each year, ripping communities and families apart as people are thrown in jail or prison and gain criminal records. Enforcement of these laws also costs money, while legalizing and taxing marijuana could bring in extra revenue — although typically not that much, based on Colorado’s experience, where marijuana taxes make up less than 1 percent of the general budget.

The black market for marijuana fuels violence around the world — not only can it lead to conflicts and violence within Canada, but the money from illegally produced and sold pot often goes back to drug cartels that then use that money to carry out brutal violence, including murders, beheadings, kidnappings, and torture. Legalization shifts marijuana out of the illicit, potentially violent market toward a legal one that can produce legitimate jobs.

Legalization carries risks too. It could lead to more use and misuse by making pot cheaper and more available. Mark Kleiman, a drug policy expert at New York University’s Marron Institute, estimates that in the long term a legal marijuana joint will cost no more to make than, say, a tea bag — since both products come from plants that are fairly easy to grow. It would also be available to anyone (of legal age) in retail outlets after legalization — meaning it would no longer require a shady or secretive meeting with a drug dealer. Those are benefits for people who use marijuana without problems, to be sure, but easier access could also pose a risk for people who can’t control their cannabis consumption.

Although marijuana isn’t very dangerous compared to some drugs, it does carry some risks: dependence and overuse, accidents, nondeadly overdoses that lead to mental anguish and anxiety, and, in rare cases, psychotic episodes. Still, it’s never been definitively linked to any serious ailments — not deadly overdoses, lung disease, or schizophrenia. And it’s much less likely — around one-tenth so, based on data for fatal car crashes — to cause deadly accidents compared to alcohol, which is legal.

Among the risks, drug policy experts emphasize the risk of overuse and addiction. As Jon Caulkins, a drug policy expert at Carnegie Mellon University, has told me, “At some level, we know that spending more than half of your waking hours intoxicated for years and years on end is not increasing the likelihood that you’ll win a Pulitzer Prize or discover the cure for cancer.”

A balancing act

To this end, Canada is striking a balance unlike that of the US’s legalization experiments so far.

So far in the US, the eight states that have legalized pot sales have done so with a model similar to alcohol. (Vermont has only legalized possession, not retail sales.) Basically, they’re setting up their systems to allow a for-profit pot industry to flourish, similar to the alcohol industry.

Drug policy experts, however, often point to the alcohol industry as a warning, not something to be admired and followed for other drugs. For decades, big alcohol has successfully lobbied lawmakers to block tax increases and regulations on alcohol, all while marketing its product as fun and sexy in television programs, such as the Super Bowl, that are viewed by millions of Americans, including children. Meanwhile, excessive drinking is linked to 88,000 deaths each year in the US.

If marijuana companies are able to act like the tobacco and alcohol industries have in the past, there's a good chance they’ll convince more Americans to try or even regularly use marijuana, and some of the heaviest users may use more of the drug. And as these companies increase their profits, they’ll be able to influence lawmakers in a way that could stifle regulations or other policies that curtail cannabis misuse. All of that will likely prove bad for public health (although likely not as bad as alcohol, since alcohol is simply more dangerous).

There are policies that can curtail this, some of which Canada’s plan will allow.

For example, Canada’s measure restricts marketing and advertising. In the US, this is generally more difficult because the First Amendment protects commercial free speech. (Tobacco marketing is largely prohibited due to a massive legal settlement.) But in Canada, the restrictions could stop marijuana companies from marketing their product in a way that targets, say, children or people who already heavily use cannabis.

“It’s a no-brainer,” Caulkins previously told me. For public health purposes, “every serious researcher around the world thinks it’s a very good idea to restrict advertising of tobacco, alcohol, any dependence-inducing substance.”

Canada’s bill also lets provinces entirely handle the distribution and sales of marijuana — up to letting provincial governments directly manage and staff all pot stores by themselves. While state-run liquor stores aren’t unheard of in the US when it comes to alcohol, it’s widely seen as risky in America with marijuana: Since cannabis is illegal at the federal level, asking state employees to run marijuana shops would effectively ask them to violate federal law. But since Canada is legalizing marijuana nationwide in one go, it can do this — and several provinces are expected to take up this option.

The promise of government-run marijuana shops is that they could be better for public health. In short, government agencies that run shops are generally going to be more mindful of public health and safety, while private companies are only going to be interested in maximizing sales, even if that means making prices very low or selling to minors and people with drug use disorders. Previous research found that states that maintained a government-operated monopoly for alcohol kept prices higher, reduced youth access, and reduced overall levels of use — all benefits to public health.

Again, this is about balancing the risks and benefits of legalization: Maybe legalization is the better approach on net compared to prohibition, but that doesn’t mean that for-profit, private companies have to be given free rein over the market.

This isn’t important just to Canada. If Canada shows that these policies — and the many other quirks that will make it different to the US — are the right approach to legalization, it could provide a legalization model to the rest of the world that’s very different from what America has done so far.

Canada’s legalization bill could violate international treaties

From the 1960s through the ’80s, much of the world, including the US and Canada, signed on to three major international drug policy treaties: the Single Convention on Narcotic Drugs of 1961, the Convention on Psychotropic Drugs of 1971, and the United Nations Convention against Illicit Traffic in Narcotic Drugs and Psychotropic Substances of 1988. Combined, the treaties require participants to limit and even prohibit the possession, use, trade, and distribution of drugs outside of medical and scientific purposes, and work together to stop international drug trafficking.

There is some debate about whether these treaties stop countries from decriminalizing marijuana — when criminal penalties are repealed but civil ones remain in place — and legalizing medical marijuana. But one thing the treaties are absolutely clear on is that illicit drugs aren’t to be allowed for recreational use and certainly not for recreational sales. Yet that’s exactly what Canada has now moved to allow.

Canada’s decision to legalize pot is the most high-profile rebuke of the international treaties since they were signed — since Canada is a relatively large developed country and is fairly active in the international arena.

In theory, Canada could face diplomatic backlash by legalizing pot. But it’s unclear who would lead such an effort, given that the US, the de facto enforcer of the treaties over the past few decades, is currently allowing states to legalize pot without federal interference.

There’s one way Canada could get around the treaty problem. In the early 2010s, Bolivia moved to allow coca leaf chewing, which was banned from the treaties. To get around this, the country effectively withdrew from the 1961 Single Convention on Narcotic Drugs, and then rejoined with a “reservation” allowing the use of coca leaves within its own borders. The move could have been blocked by one-third of the parties to the treaty — which would amount to more than 60 nations — but only 15 joined in opposition.

Canada could use a similar process — of withdrawing and then rejoining with a reservation for legal pot — to meet its treaty obligations.

It could also follow Uruguay, which has essentially refused to acknowledge that legalization violates the treaties. Despite warnings from the UN Office on Drugs and Crime, no one has taken significant action against Uruguay for its decision.

As for the US, it claims to respect the drug treaties, despite some states’ move to legalize marijuana, with a clever argument: It’s true that multiple states have legalized pot, but the federal government still considers marijuana illegal, so the nation is still technically in line, even if a few states are not. Canada could not try this route if it legalizes nationwide.

If Canada pulls this off, it could provide a model for other countries to relax their drug laws — and particularly their marijuana laws — without violating international treaty obligations or, at the very least, without getting punished for disobeying the treaties.

Such a move would come at a very crucial time in international drug policy: After the UN’s special session on drugs in 2016, drug policy reformers are putting more pressure to reform the global drug control regime. Canadian legalization gives these reformers an opening by showing that if the treaties aren’t changed, they may soon be rendered meaningless as countries move ahead with their own reforms anyway — even if it puts them in violation of international drug law. And that could open up the rest of the world to legalizing pot.

It’s not just, then, that Canada is changing its own drug laws. Canada’s steps — from its rebuke of international drug treaties to how it will regulate cannabis — could affect the future of marijuana policy worldwide.

For more on marijuana legalization, read Vox’s explainer.

Correction: This article originally referenced provisions of the Canadian law that were very recently stripped out.