Canada's Senate has given final passage to the federal government's bill to legalise recreational cannabis, though Canadians will have to wait at least a few months to legally buy marijuana.
Prime Minister Justin Trudeau's government had hoped to make cannabis legal by July 1, but the government has said provincial and territorial governments will need eight to 12 weeks following Senate passage and royal assent to prepare for retail sales.
Mr Trudeau's Cabinet is expected to decide a legalisation date in early or mid-September.
The law makes Canada the second country to have a nationwide, legal marijuana market, after Uruguay. Each province in Canada is coming up with rules for the sale of recreational marijuana.
The bill passed in the Senate by a vote of 52-29 on Tuesday.
Independent Senator Tony Dean, who sponsored the bill in the upper house, said: "We have seen in the Senate tonight a historic vote that ends 90 years of prohibition of cannabis in this country, 90 years of needless criminalisation, 90 years of a just-say-no approach to drugs that hasn't worked."
Canada is the largest developed country to end a nationwide prohibition on marijuana use.
In the neighbouring US, nine states and the District of Columbia have legalised marijuana. California, home to one in eight Americans, launched the United States' biggest legal marijuana marketplace on January 1.
The Canadian government largely followed the advice of a marijuana task force headed by former Liberal Health Minister Anne McLellan as well as the advice of former Toronto Police Chief Bill Blair, who is the parliamentary secretary to the justice minister.
The task force recommended adults be allowed to carry up to 30 grams of marijuana and grow up to four plants. It also said marijuana should not be sold in the same location as alcohol or tobacco.
The most controversial aspect of Canada's move to legalise marijuana nationwide has been setting the minimum age for use at 18 or 19, depending on the province. That is lower than in US states that have embraced legalisation.
Advocates argued that putting the limit at 21 would encourage a black market and drive youths into the hands of criminals. But some health experts have worried that the lower age will encourage use of a substance that can have long-term consequences on still-maturing brains.