All 50 members of the governing Broad Front coalition approved the proposal in a party line vote just before midnight Wednesday, keeping a narrow majority of the 96 lawmakers present after more than 13 hours of passionate debate.
The measure now goes to the Senate, where Mujica's coalition has a bigger majority and passage is expected to come within weeks for the proposal to make Uruguay the world's first nation to create a legal, regulated marijuana market.
"Sometimes small countries do great things," said Ethan Nadelmann, executive director of the U.S. Drug Policy Alliance. "Uruguay's bold move does more than follow in the footsteps of Colorado and Washington. It provides a model for legally regulating marijuana that other countries, and U.S. states, will want to consider - and a precedent that will embolden others to follow in their footsteps."
Marijuana legalization efforts have gained momentum across the Americas in recent years as leaders watch the death toll rise from military responses to unabated drug trafficking in Mexico and Central America. Presidents Juan Manuel Santos of Colombia and Otto Perez Molina of Guatemala also have called for reforms, and a recent report by a commission of the Organization of American States encouraged new approaches, including legalization of marijuana.
But no sitting president has gone as far as Mujica to support the creation of legal alternatives to marijuana trafficking.
"At the heart of the Uruguayan marijuana regulation bill is a focus on improving public health and public safety," said Hannah Hetzer, a Drug Policy Alliance staffer who moved to Montevideo to help shepherd the proposal. "Instead of closing their eyes to the problem of drug abuse and drug trafficking, Uruguay is taking an important step towards responsible regulation of an existing reality."
Legislators in the governing coalition said putting the government at the centre of a legal marijuana industry is worth trying because the global war on drugs had been a costly and bloody failure, and displacing illegal dealers through licensed pot sales could save money and lives.
They also hope to eliminate a legal contradiction in Uruguay, where it has been legal to use pot but against the law to sell it, buy it, produce it or possess even one marijuana plant.
Critics warned that marijuana is a gateway drug and said fostering the bad habits of addicts is playing with fire.
Mujica said he never consumed marijuana, but believes regulations are necessary because many other people do, even though recent polls suggest two-thirds of Uruguayans oppose the plan.
National Party Deputy Gerardo Amarilla said the government was underestimating the risk of marijuana, which he called a "gateway drug" for other chemical addictions that foster violent crimes.
"Ninety-eight per cent of those who are today destroying themselves with base cocaine began with marijuana," Amarilla said. "I believe that we're risking too much. I have the sensation that we're playing with fire."
Under the legislation, Uruguay's government would license growers, sellers and consumers, and update a confidential registry to keep people from buying more than 40 grams a month.
Carrying, growing or selling pot without a license could bring prison terms, but licensed consumers could grow up to six plants at a time at home.
Growing clubs with up to 45 members each would be encouraged, fostering enough marijuana production to drive out unlicensed dealers and draw a line between pot smokers and users of harder drugs.
The latest proposal "has some adjustments, aimed at strengthening the educational issue and prohibiting driving under the effects of cannabis," ruling coalition deputy Sebastian Sabini said. "There will be self-growing clubs, and it will also be possible to buy marijuana in pharmacies" that is mass-produced by private companies.
An Institute for Regulation and Control of Cannabis would be created, with the power to grant licenses for all aspects of a legal industry to produce marijuana for recreational, medicinal or industrial use.
Dozens of pro-marijuana activists followed the debate from balconies overlooking the house floor, while others outside held signs and danced to reggae music.
"This law consecrates a reality that already exists: The marijuana sales market has existed for a long time, but illegally, buying it from traffickers, and in having plants in your house for which you can be thrown in jail," said Camilo Collazo, a 25-year-old anthropology student. "We want to put an end to this, to clean up and normalize the situation."
The heavy toll, costs and questionable results of military responses to illegal drugs have motivated marijuana legalization initiatives in the U.S. states of Colorado and Washington, and inspired many world leaders to re-think drug laws.
The secretary-general of the Organization of American States, Jose Miguel Inzulza, told Mujica last week that his members had no objections. Pope Francis, however, said during his visit to Brazil that the "liberalization of drugs, which is being discussed in several Latin American countries, is not what will reduce the spread of chemical substances."
Associated Press Writer Michael Warren in Buenos Aires contributed to this report.