MEDELLIN, Colombia — Tens of thousands of Colombians died in the U.S.-backed war on drugs. But after an official about-face on marijuana, Colombia is looking to exchange gun-toting traffickers for corporate backers in a bid to become the Saudi Arabia of legal pot.

The new industry is budding here on the outskirts of Medellin, where Pablo Escobar moved marijuana in the 1970s before becoming the “King of Cocaine.” Fifteen years after his death in a last stand with the law, cannabis plants are blooming in the emerald hills beyond the city, this time with the government’s blessing.

“You are looking at history,” beamed Camilo Ospina, the lab-coat-wearing chief innovation officer for PharmaCielo Colombia Holdings, gesturing like a showman before a sprawling greenhouse of pungent cannabis plants. His company is one of a fast-rising number of corporations seeking to leverage the “made in Colombia” label in a new age of legalization.

“Our advantage is that the Colombian brand already has a mystique,” he said. “We want to intensify that, so that the Colombian cannabis you already know – the Punto Rojo, the Colombian Gold – is the cannabis you want to buy.”

Colombia is still a hotbed of illegal drugs: A report last year from the U.S. Drug Enforcement Agency showed Colombia as the source of 92 percent of cocaine seized on U.S. soil. And after 18 years and $10 billion spent on Plan Colombia, the U.S.-funded effort to counter cartels and coca farmers, cocaine production here is at all-time highs.

Yet when it comes to marijuana, Colombia is taking a new tack: If you can’t beat ’em, regulate ’em.

In 2016, the country passed a landmark law legalizing medical marijuana for both domestic use and export, laying the groundwork for the new industry. The government started handing out the first licenses to grow, process and export medicinal cannabis in September, approving 33 companies so far. Legal growers such as Canadian-owned PharmaCielo are now raising test crops for upcoming product lines, with the first commercial sales and exports slated for the coming weeks and months.

Becoming the world’s supplier of legal cannabis won’t be easy. The biggest potential market, the United States, remains closed off, with even states that have legalized use banning cannabis imports. Yet a growing group of other countries, including Germany, Peru, Italy and Croatia, are seen as fast-developing export markets for medical marijuana.

Canada and the Netherlands, on the cutting edge of the legal pot business, have started to meet that demand, with several companies already exporting domestically cultivated crops.

But Colombia, officials here say, is the logical place for the industry’s future.

With a climate well suited to the surprisingly fragile cannabis plant, the country supplied most of the illicit marijuana consumed in the United States during the 1970s and ’80s — a dubious crown it later lost to Mexico. As more countries approve some form of legalization, Colombia is bent on recapturing its global dominance, albeit through export licenses and customs procedures instead of clandestine shipments in the night.

It amounts to a sea change in thinking. Rather than part of the problem, marijuana is being viewed as one solution to Colombia’s struggle against illicit narcotics – particularly coca leaf, the building block of cocaine. Perhaps it is time, authorities say, for coca farmers to start seeing legal marijuana as a potentially lucrative substitute crop.

“The message is, go the legal route with marijuana,” said Andrés López Velasco, head of Colombia’s National Narcotics Fund, the government agency overseeing legal cannabis. “You can keep your know-how, your knowledge of how to cultivate. But do it legally.”

Not everyone is convinced.

Some local authorities in the regions where companies are poised to start growing commercial marijuana remain cautious. They fear cultivation of stronger strains popular with recreational users, which are also permitted under the rules issued in September, may undermine the image of the budding pot industry as purely pharmaceutical.

Other critics insist the government is sending a negative signal to children, while rekindling the image of Colombia as the world’s factory for controlled substances.

“By saying it can be commercially grown and has a medicinal use, we are telling our children not only that marijuana is not bad but that it’s actually good for your health,” said Rafael Nieto, a former vice justice minister and conservative politician. “I’m sorry, I just don’t believe that.”

Nevertheless, here in the foothills of the Andes, Colombia is seeding the future of a new – or rather, old – industry.

In 1986, Colombia decriminalized small-scale growth for personal use, allowing the cultivation of up to 20 plants. President Juan Manuel Santos pressed for medicinal legalization on a commercial scale as early as 2012 and hailed the 2016 legislation as a major leap of progress.

The nascent industry here still faces hurdles.

Some form of medical marijuana is now legal in more than a dozen nations – with recreational legalization close in Canada, and a reality in Uruguay and U.S. states including California. But it remains illegal in most places.

“Convincing foreign governments to allow imports” will probably be the biggest challenge for growers, said Bethany Gomez, research director for Chicago-based Brightfield Group, a market research firm.

Still, the global trade in legal pot is growing, with some experts predicting the market could be worth $31.6 billion by 2021.

At least some local farmers, especially indigenous groups that have long dallied in small-scale marijuana farming at the behest of drug traffickers, are seizing on the chance to go legit.

“This is our chance to be part of a legal system,” said Ariel Huetio, a community organizer who represents indigenous farmers in the western state of Cauca. They’ve struck a deal to produce and supply cannabis to FCM Global, a Medellin-based company that has set up a production facility 27 miles southeast of the city. “This is our chance to say no to the wrong people and yes to the right ones.”

A Canadian company, Khiron Life Sciences, expects its first harvests in Colombia later this year. Its plan: Sell the cannabis through branded clinics in Colombia, then export the concept across Latin America and beyond, becoming a sort of farm-to-table marijuana dispensary.

“We don’t see ourselves as drug dealers,” said Alvaro Torres, Khiron’s chief executive. “We’re a pharmaceutical company.”

To keep things on the up and up, the new regulations for commercial marijuana here strictly limit access to legal farms and impose measures – including genetic testing – to prevent illegally grown cannabis from filtering into the legal market.

Some companies, such as FCM Global, have gone a step further: opting to grow only weaker cannabis strains while refraining from the stronger ones popular with recreational users.

“I lived through the Escobar years. I lost friends during those years. And when I see the TV shows that glorify that guy, it makes me sick,” said Carlos Velasquez, FCM Global’s chief executive. “What we’re doing with medical marijuana is totally different. We want no part of that past, any of it.”