The federal government has been scrambling to draft legislation to legalize the recreational use of marijuana, hoping to have a bill in place ahead of the symbolic date of April 20, sources said.

A senior federal official said preparing the legislation has exposed a number of divisions on key issues between the Health, Justice and Public Safety departments, requiring federal lawyers to work overtime to find the appropriate legal language to express the government's final intentions.

The government is hoping to legalize pot by July 1, 2018, CBC News reported Sunday night.

Story continues below advertisement

The governing Liberals used last year's 4/20 celebrations – festivals held annually across the country in which marijuana enthusiasts publicly light up – to announce that they would table their legislation this spring. The government is now hoping to table the long-awaited bill in less than a month, ahead of that same date this year, sources said.

Globe Investigation: What's in your weed? We tested dispensary marijuana to find out

This would entail introducing the legislation in the week of April 10, as the House will be on break during the actual celebrations of April 20 the following week.

Another senior official said there are still "lots of moving parts" as the government tackles complex issues such as whether to allow home production of small amounts of marijuana and the best way to crack down on drug-impaired drivers.

"The government has to decide how it will handle all sorts of things," the federal official said. "It's big and complicated."

A third federal official cautioned that the legal drafting and cabinet-approval process could drag into early May. Still, the official said the government wants to unveil the legislation as soon as possible to ensure that the House of Commons has time to study the bill before the summer break.

Liberal MP Bill Blair, who is parliamentary secretary to the Minister of Justice and Ottawa's point man on the legalization file, has said that the production and sale of marijuana will be tightly regulated.

Story continues below advertisement

The legislation will be inspired by a task force that was led by former Liberal minister Anne McLellan, which proposed a complete legalization model in a well-received report last year.

Prime Minister Justin Trudeau has already endorsed one of its key recommendations, namely that marijuana should be legal for 18- or 19-year-olds, depending on each province's legal drinking age.

The task force also urged the government to allow Canadians to buy or carry 30 grams of marijuana for personal use, and to grow up to four plants at home. The task force also recommended a system that would feature storefront sales and mail-order distribution, and allow a wide range of producers to operate legally, including "craft" growers and the current producers of medical marijuana.

Mr. Trudeau said last year that the Liberal government was in overall agreement with the task force's 80 recommendations.

Even if the legislation was tabled in the coming weeks, it remains unknown when marijuana will actually be legal for recreational users. A senior federal official said last year that the time frame will depend on the "readiness of the provinces," which will regulate wholesale distribution and retailing. The official said aiming for 2018 would be ambitious, with 2019 being more likely.