MONTEVIDEO - Pharmacies in Uruguay began selling cannabis directly to consumers on Wednesday, culminating a long and pioneering legalization effort that began over three years ago.

The South American country of 3.4 million people is the first in the world to legalize the entire process of marijuana production for recreational use, including its cultivation and sale.

The law was passed in late 2013 as Uruguay sought to shift the market from criminals to its own government. The product is grown, packaged and distributed by two companies, Symbiosis and Iccorp, authorized and taxed by the state.

But the rollout has been slow as the government has faced internal opposition and tricky logistics. In the meantime, several other countries have moved towards a more flexible approach to regulation.

In Uruguay, any citizen over the age of 18 can now register to buy cannabis. Aided by fingerprint recognition technology, they can buy up to 40 grams (1.41 ounces) monthly for their personal use.

Registered users - nearly 5,000 so far - can buy 5-gram (0.18-ounce) sealed packets for $6.50 each.

One of the first to take up the opportunity was Xavier Ferreyra, a 32-year-old public sector employee.

"Now we're at a point where freedom to consume is guaranteed," he said, as he waited in line to buy his first packet.

For pharmacists like Sebastian Scaffo, who runs one of the 16 pharmacies in Uruguay authorized to sell the drug, it is an opportunity to bring in more clients and profit. In the first hour, he sold 15 packets.

Smokers can choose between two brands - "Alfa 1," an "indica" variety that relaxes users, and "Beta 1," the more energizing "sativa" strain of cannabis.

Both varieties have a relatively low content of tetrahydrocannabinol (THC), local experts said, referring to the active ingredient in the plant that creates the high.

Its production will be carefully monitored to prevent sales to foreigners or people leaving the country, the government says.

The original government-sponsored legislation emerged during the presidency of Jose Mujica, a leftist ex-guerrilla who promoted a number of progressive reforms in Uruguay.

But the authorization for pharmacies to sell cannabis - initially expected by the end of 2014 - was postponed several times.

Since then, other countries in Latin America have moved toward allowing cannabis for medical use. A number of U.S. states have legalized recreational use and Canada is on track to legalize the drug by next year.