RIO DE JANEIRO — Uruguay’s lower house late Wednesday night approved a sweeping bill to legalize marijuana, opening the way for the authorities to create one of Latin America’s most ambitious nationwide endeavors in overhauling drug policy.

Following hours of debate, legislators in Uruguay’s capital, Montevideo, voted 50 to 46 in favor of the legislation, which now goes to the Senate, where lawmakers have assured President José Mujica that they have a comfortable majority to approve it. Mr. Mujica supports the bill, arguing that it is needed to redirect police resources toward fighting street crime and smugglers involved in trafficking other types of drugs.

“This is a very innovative bill, with the state deciding to regulate the entire chain of production, distribution and access to the substance,” said Laura Blanco, president of Uruguay’s Cannabis Studies Association. She said the bill sent an “encouraging” sign to other Latin American nations, as political leaders in parts of the region debate whether to follow Uruguay’s example.

Under Mr. Mujica, 78, an outspoken former guerrilla, Uruguay has emerged as a laboratory for socially liberal policies. A small nation of 3.3 million people, the country has also enacted a groundbreaking abortion rights law, moved to legalize same-sex marriage and is seeking to become a center for renewable energy ventures.