Cannabis will be legal to buy in Canada by the end of the year, Justin Trudeau has announced.

The prime minister says marijuana will be legal nationwide from 17 October in a move that he hopes will take the market away from organised crime.

The legislation will make Canada only the second country in the world to make pot legal.

Image: Cannabis is to become totally legal in Canada in October

"Over the following months and indeed years we will completely replace or almost completely replace the organised crime market on that," he told a news conference.

Canada is following the lead of Uruguay in allowing a nationwide, legal marijuana market, although provinces will be able to set their own laws.


"It is our hope as of October 17 there will be a smooth operation of retail cannabis outlets operated by the provinces with an online mail delivery system operated by the provinces that will ensure that this happens in an orderly fashion," Mr Trudeau said.

Image: Justin Trudeau says he wants to protect Canada's young people

"The legislation is transformative," said justice minister Jody Wilson-Raybould, adding it "marks a wholesale shift in how our country approaches cannabis, leaving behind a failed model of prohibition."

There are still questions surrounding how police will test motorists suspected of driving under the influence, what to do about those with prior marijuana convictions and just how the rules governing home cultivation will work.

"There's no point looking at pardons while the old law is in the books," Mr Trudeau said.

It’s been too easy for our kids to get marijuana - and for criminals to reap the profits. Today, we change that. Our plan to legalize & regulate marijuana just passed the Senate. #PromiseKept — Justin Trudeau (@JustinTrudeau) June 20, 2018

Mr Trudeau had promised to legalise the drug during the 2015 election and had set a goal of 1 July to do so.

In the 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 at the start of the year.