(Reuters) - Canada’s No. 2 marijuana producer Aurora Cannabis Inc has agreed to buy smaller rival CanniMed Therapeutics Inc for C$1.1 billion ($852 million) as companies jostle to benefit from the country’s legalization of recreational marijuana use later this year.

The agreement to create the world’s top marijuana producer by market value follows months of tensions between the companies. Aurora had originally made a hostile bid capped at C$24 per share for CanniMed, and increased it to C$43 in the new offer.

The deal marked the world’s biggest marijuana industry transaction, bringing the value of cannabis deals so far this year to $1.2 billion, more than double 2017’s total, itself a record, according to Thomson Reuters data.

(Factbox on top global marijuana deals:)

The activity has been largely concentrated in Canada, which is set to legalize recreational use of marijuana by mid-2018, becoming the second country in the world to do so after Uruguay.

With countries including Australia and Germany allowing medical marijuana and many others moving closer to doing so, Canada’s early move gives it an edge. While several U.S. states have legalized cannabis for medical or recreational use, the substance remains illegal at the federal level.

By buying CanniMed, Aurora hopes to bolster its capacity to meet domestic demand and increase distribution around the world.

“The action is where the medical cannabis export markets are, which are much larger than Canada,” said Chris Damas, editor of the BCMI Cannabis Report. “CanniMed has patents, they have relationships with different universities, research and clinical trials, and export relations with other countries, and Aurora wants to add to their own relationships in Europe.”

‘QUITE A JOURNEY’

FILE PHOTO: A marijuana plant is seen at the The Global Marijuana March in Toronto, May 7, 2011. REUTERS/Mark Blinch/File Photo

Canadian cannabis stocks have been on a tear in anticipation of the surge in demand, but have prompted fears of a bubble and predictions for corrections from many market commentators. But so far the sector has continued on a relentless upward path.

CanniMed rose 11.7 percent to close at C$41.90 after jumping as much as 23 percent. Aurora shares reversed earlier gains to end 5.5 percent lower at C$13.98.

Still, Aurora shares are up 395 percent over the past three months, while CanniMed has risen 257 percent.

CanniMed was itself engaged in a friendly deal to buy Newstrike Resources Ltd, but called it off on Wednesday.

Newstrike shares tumbled 19.2 percent before it was halted as the company prepared to raise C$51.48 million to “fund strategic growth opportunities.” The stock fell 17 percent on Tuesday.

“It’s been quite a journey, but the things we’re going to do together in 2018 and beyond will be amazing,” Aurora Chief Corporate Officer Cam Battley told Reuters. “Newstrike wasn’t really on our radar screen. Our interest was primarily in CanniMed.”

The deal would give the combined entity a market value of C$7.4 billion, overtaking current world leader Canopy Growth Corp’s C$6.7 billion. Canopy shares closed down 4.8 percent at C$34.87 in their third session of losses.

“If I were Canopy, I’d be concerned,” Damas said. “The bigger Aurora gets, the more competition (Canopy is) going to face in both Canada and overseas.”

Still, Canopy will retain its leading position, with capacity at existing and planned facilities exceeding those of both Aurora and CanniMed.

The new combined entity’s market value would also top some older and well-established Canadian companies, including Bombardier Inc, which is valued at about C$7.1 billion.

Aurora’s revised offer of 3.4 of its shares for each CanniMed security, equates to C$43.00, based on an implied share price for Aurora of C$12.65, a 15 percent premium to CanniMed’s closing price on Tuesday.

The deal requires shareholder and regulatory approvals. Aurora has received support from 36 percent of CanniMed shareholders, it said.