MEXICO CITY (Reuters) - Many top companies cashing in on legal cannabis are considering a bet on Mexico after a Supreme Court decision raised hopes for a legalization of medical and recreational marijuana in a country reeling from years of gruesome drug violence.

A man gestures during a demonstration in support of the legalization of marijuana outside the Supreme Court building in Mexico City, in this November 4, 2015 file photo. REUTERS/Edgard Garrido/Files

From medical marijuana growers to pot private equity firms, many weed entrepreneurs see Mexico as a tempting new business opportunity even though cannabis is still illegal and the market is currently controlled by ruthless drug cartels.

“Me personally, I’m not afraid to go to Mexico,” said Daniel Sparks, head of government affairs at BioTrackTHC, a U.S.-based provider of marijuana supply-chain software.

He said that just as mafia groups and bootleggers gave up on illicit moonshine after Prohibition ended in the United States, Mexico’s drug gangs would have little interest in a legal marijuana market, especially if it lured in reputable pharmaceutical and tech firms.

“I am not so optimistic to think that a cannabis business in Mexico would not encounter opposition or violence from the cartels. However, their profit margins are being eroded daily, monthly and yearly by the continued expansion of medical and recreational marijuana programs in more and more U.S. states.”

Canada’s new prime minister, Justin Trudeau, has promised to legalize the drug and a Supreme Court decision in November opened the door for Mexico to one day follow suit, prompting the ruling party to present a bill to regulate medical marijuana.

“It shows North America ... is moving in the same direction, and that’s more than just symbolic: it’s indicative of what will happen at a global scale,” said Brendan Kennedy, chief executive of pot private equity firm Privateer Holdings. “Mexico is an interesting investment opportunity.”

His firm calculates a legal medical and recreational cannabis market in Mexico could be worth $1.7 billion a year.

Products that firms could offer range from marijuana plants for medical usage and cannabis-based medicines to supply-chain software, allowing regulators to track suppliers and inventory, and pot-themed social media websites.

The U.S. legal pot market was worth some $3.5 billion in 2015, according to marijuana investment and research firm the ArcView Group. A federal U.S. legalization of marijuana would create a market worth $36.8 billion in retail sales, it said.

Slideshow ( 2 images )

MEDICAL TOURISM

The Supreme Court decision in Mexico only allows four plaintiffs who brought the case to grow and smoke their own marijuana.

Polls show most Mexicans oppose outright legalization, including President Enrique Pena Nieto, although he has called for a national debate on the matter.

There is more support for medical marijuana regulation, and lawmakers say the bill submitted by Pena Nieto’s Institutional Revolutionary Party (PRI) is likely to pass in some form.

With a population of 120 million people, Mexico could provide a sizeable market for marijuana investors. Still, the seven cannabis companies, legalization advocates and lawmakers consulted for this article stressed any opening would take time.

“It’s likely a market that is of some interest to the company, but not immediate interest” said Stephen Schultz, spokesman for Britain’s GW Pharmaceuticals, which produces Sativex, a cannabis-derived medicine.

Uruguay blazed a trail in 2013 by becoming the first country to allow the commercial cultivation and distribution of weed. But it has struggled to roll out the project and legal marijuana won’t be available on pharmacy shelves until mid-2016, about 18 months later than planned.

How Mexico’s market develops will affect investment.

As it stands, the PRI’s medical marijuana bill only allows for imported cannabis. That has upset some, like Mexico City Mayor Miguel Angel Mancera, who argue that any legislation should help foment a domestic medical marijuana industry.

Sparks said if Mexico allowed the 8 million U.S. and Canadian tourists who visit each year to get access to marijuana prescriptions, it would give investors a powerful incentive.

Joseph Harkins of the Medical Tourism Association said U.S. insurers already offer some medical coverage in Mexico and that medical marijuana tourism is in the industry’s sights.

DRUG WAR

More than 100,000 people have been killed in Mexico’s drug wars in the past decade, and some would-be investors declined to speak for fear of attracting unwanted attention.

“From what I’ve heard, and personal discussions I’ve had, some people and organizations are a little apprehensive about even physically going to Mexico, let alone providing their services,” said Sparks.

He said he is not worried, though, as BioTrackTHC’s inventory software is unlikely to be fought over by the cartels.

Kennedy said the growth of legal marijuana in the United States had dimmed its criminal appeal, and that federal support for a regulated Mexican market would reassure investors.

“There’s lots of American and international companies that produce things in Mexico,” he said. “If we thought we were going to be in competition with the cartels, I don’t think Mexico would be a place we would be interested in.”

However, even Mexico’s established medical industry can operate under constraints.

Mikel Arriola, the head of health regulator Cofepris, said until last year, Mexican doctors only wrote a few dozen morphine prescriptions a month as their home addresses appeared on them and they feared their access to the drug may attract criminal attention. “They were scared.”