The Senate has passed a bill to legalize recreational marijuana.

After more than six hours of speeches, senators passed Bill C-45, which is also known as the Cannabis Act, on its third reading Thursday night. The bill was passed 56 to 30, with one abstention.

The vote was one of the final challenges facing Prime Minister Justin Trudeau’s key promise to legalize marijuana this year. In the face of staunch opposition from the upper chamber’s 32 Conservative members, Trudeau had appointed three new independent senators over the past week, in an apparent bid to better the bill’s chances of succeeding.

Two of them -- Donna Dasko, a pollster and media commentator who now represents Ontario, and former judge Pierre Dalphond, who takes a seat representing Quebec -- were only sworn in Thursday afternoon, just hours before the vote. Mohamed-Iqbal Ravalia, a physician and professor who now represents Newfoundland and Labrador, was sworn in on June 4. All three voted in favour of the bill.

The bill, as it was passed in the Senate, differs somewhat from the one crafted in the House of Commons.

Last week, the Senate’s social affairs committee proposed more than 40 amendments ahead of Thursday’s vote, such as one that would allow provinces to ban home cultivation -- something that both Quebec and Manitoba plan to do. Other amendments include prohibiting cannabis companies from distributing branded merchandise, such as T-shirts, while another would make it a ticketable offence for a young adult to share marijuana with someone who is no more than two years younger than they are.

Now that the bill has been passed in the Senate, it will return to the House of Commons, where the amendments may be approved, rejected or modified. Following that process, the bill will then go back to the Senate for another vote where further amendments could then be proposed.

That means that despite an earlier July 1 promise from the Liberals, it could be weeks -- if not months -- before marijuana becomes legal for recreational use in Canada, thus ending a prohibition that has stood since 1923. Health Minister Ginette Petitpas, moreover, has previously said that after the bill is finalized and becomes law, it will take an additional two to three months before provinces and territories are ready for retail sales.

Still, Tony Dean of the Independent Senate Group, who sponsored Bill C-45, called Thursday “a historic night.”

“We’ve had the bill in the Senate for seven months now,” the Ontario senator added in an interview with CTV Power Play host Don Martin earlier Thursday. “It has been reviewed by five committees of the Senate, which is pretty much unprecedented… We have examined the bill exhaustively, and I can say personally that it has been exhausting.”

Appearing alongside Dean, Quebec Conservative senator Leo Housakos accused the Liberal government of not doing “its due diligence” in regards to marijuana legalization.

“They keep saying the overarching goal of this bill is of course to try to reduce marijuana use amongst young Canadians,” he said. “We don’t see very many signs of that.”

Housakos said he hopes the government will “heed our concerns and be open to those amendments” that aim to protect young people.

With files from The Canadian Press