LIMA, Peru — By most measures the anti-narcotics raid was a raging success. After forcing their way into the apartment, police here in Peru's capital seized five kilograms (11 pounds) of cannabis and equipment, including grow lights and fertilizer.

The entire property in the Lima district of San Miguel, overlooking the South Pacific, had been converted into an underground lab to produce significant quantities of the prohibited soft drug — a lab that the officers had put out of action.

However, when it comes to the law of unintended consequences, the operation in February 2017 may be hard to beat. It triggered a chain of events that has culminated with Peru, one of Latin America's most conservative societies, enacting what is being hailed as arguably the region's most comprehensive medical marijuana law.

The new law, passed in February, puts the Andean nation at the forefront of a growing trend south of the Rio Grande to legally embrace therapeutic — and in a growing number of cases recreational — cannabis use.

As it turned out, the San Miguel lab was not being run by organized criminals seeking to make a profit. Instead, it was the work of a group of desperate families, mainly mothers, producing cannabis for seriously ill relatives, an often highly successful treatment option that was strictly prohibited by Peruvian law.

The families had banded together to form a group called Buscando Esperanza (Spanish for Searching for Hope), aimed at both self-help and campaigning for change. In the days following the raid, Peruvian media gave the group highly sympathetic coverage, leading to a sea change in public opinion and paving the way for legal reform in the country's Congress, dominated by right-wing lawmakers.

Earlier this year, the Congress approved Law 30681 , which legalizes and regulates the cultivation, processing, importation, exportation and commercialization of registered medical marijuana products. To participate, companies need to apply for licenses from Peru's Directorate General of Medicines, Supplies and Drugs (DIGEMID).

Legalization Brings Both Hope and Worries

The legalization represents a breakthrough for Searching for Hope's leader, Ana Alvarez, whose 19-year-old son Anthony has Lennox-Gastaut Syndrome , a severe form of epilepsy. She had been facing prosecution, along with a doctor providing medical advice to the group, until a sympathetic judge shelved the case — a stroke of luck that was by no means guaranteed.

Before she gave him drops of cannabis tincture, Anthony suffered up to 10 severe seizures a day, during which he often injured himself. Over the years, he had broken his arm, several teeth, cracked open his forehead and suffered a brain hematoma. "He is full of scars," says Alvarez, 44, a dental technician.

Now, Anthony has at most two seizures a day, and often none, and they are much milder. "It has changed his life and ours as a family," she says. "He is connected to reality again. Before he was there physically, but off in a world of his own. Now he can lead a dignified life."

Among other benefits, Anthony is now, after years of being unable to adequately study, trying to graduate from high school. He attends a theater workshop to help with his socialization, something that would have been impossible without the tincture made by Searching for Hope.

Nevertheless, Alvarez is worried by an important omission in Law 30681. It does not regulate or permit cultivation by users or their families. "This law was meant to help us but I'm worried that it could do the opposite," she says. "We are not well-off. How will we be able to afford this medicine if we can no longer make it at home?"

A Push for Household Cultivation

Alberto de Belaunde, the liberal congressman who, working closely with Searching for Hope, championed the law, agrees with Alvarez.

"It's not just a question of prices. Medicinal cannabis is also highly customizable," he says, referring to THC and CBD, the two most important active compounds in medicinal marijuana products, whose levels can be tailored to individual patients' needs. De Belaunde says he will be working in the coming months to tackle that legal loophole.

"There was a lot of opposition in Congress. It was not an easy process. We had to sacrifice home cultivation to get the law passed. But it strikes me as a big omission, one that I want to address."

De Belaunde says recreational use should also be decriminalized and regulated like substances such as alcohol. "But it's very difficult to have that debate in a serious, informed way. If we had tried to include recreational use, this law never would've been passed," he adds.

Approval Spreads Across the Continent

Nevertheless, Law 30681 does put Peru in the vanguard of Latin America's embrace of medical marijuana.

Countries that have recently legalized the clinical use of cannabis include Argentina, Chile, Colombia and Uruguay, moves that have attracted something of a gold rush from North American cannabis companies.

Chile passed a law in 2015 allowing medical marijuana and decriminalizing recreational use. It took effect in 2017 and the country is now poised to become a regional leader in marijuana research.

Colombia also allowed medical marijuana in 2015 and is already the scene of legal cultivation. Medical marijuana products are expected to become available in pharmacies there this year and some have talked of the country capturing up to 20% of the global market worth potentially $40 billion .

Meanwhile, Uruguay has become the first country to fully legalize both medicinal and recreational marijuana, a bold move that has now been emulated by Canada. Some have predicted that the small South American nation, with a population of just 3 million, will become the first country to hit $1 billion in legal cannabis exports.

Recreational Use the Next Political Battle

Other countries around the world, notably Jamaica and also in Western Europe, have been moving in similar directions. Nevertheless, Latin America has various inherent advantages, says Nik Schwenker of Canopy Growth, Canada's first cannabis company to be publicly traded. Schwenker's organization is now rapidly expanding into Latin America , including buying up land in Brazil, Chile, Colombia and Peru, and readying investment capital.

Schwenker believes the region has vast potential both as a supplier of medical marijuana products and as a consumer. Climate and globally competitive wages in the agriculture sector helps South America.

"We also have a region that has a tradition of plant-based healing and many people have a history of medical (marijuana) use in their families. Latin America has 600 million people. Population-wise, Mexico alone is roughly four times bigger than Canada."

Recreational use is likely the next big battle in the region, where such consumption remains illegal in various countries, including Peru. Paraguay — easily South America's largest underground producer and which the United Nations once estimated as being the source of 15% of global cannabis supply — remains the scene of arguably the world's hottest war on weed .