Pope Francis has criticised drug legalisation plans in Latin America during the inauguration of a clinic for drug addicts in Rio de Janeiro.
The roots of drug abuse should be tackled, he said on the third day of his visit to Brazil.
Uruguay is close to allowing the legal sale of marijuana, with other countries pondering similar liberalisation.
Earlier, the Argentine-born pontiff celebrated the first Mass of his trip, at the Shrine of Our Lady of Aparecida.
He warned tens of thousands of faithful against the "passing idols" of money, power and pleasure.
After the visit to Aparecida, in the Brazilian state of Sao Paulo, the pope flew back to Rio de Janeiro.
At the inauguration of a drug rehabilitation clinic at the Sao Francisco hospital, he hugged former addicts and heard their stories.
'Dealers of death'
"It is necessary to tackle the problems which are at the root of drug abuse, promoting more justice, educating the youth with the values that live in society, standing by those who face hardship and giving them hope for the future," he said.
Pope Francis also warned against plans to legalise drugs in Latin America and condemned drug-traffickers.
"How many dealers of death there are that follow the logic of power and money at any cost! The scourge of drug-trafficking, that favours violence and sows the seeds of suffering and death, requires of society as a whole an act of courage," he said.
Leaders in Colombia, Bolivia, Ecuador and others have spoken for softer stances on drugs policy.
In Uruguay, a project decriminalising marijuana sale is set to be voted in Congress next week.
President Jose Mujica says its main goal is combating drug trafficking.
On Monday the Pope faced chaotic scenes as he arrived in Rio de Janeiro.
He is in Brazil to attend the Roman Catholic World Youth Day festival. It is his first trip abroad since becoming head of the Catholic Church in March.
The highlight of the five-day festival will be a prayer service on Rio's iconic Copacabana Beach on Thursday.
The pontiff's visit is taking place under tight security, after weeks of anti-government protests.
He travelled to the shrine in Aparecida by plane and helicopter.
Thousands of pilgrims arrived in the rural town ahead of Wednesday's Mass, which took place at the basilica holding the shrine.
"It is true that nowadays, to some extent, everyone, including our young people, feels attracted by the many idols which take the place of God and appear to offer hope - money, success, power, pleasure," the pontiff said during the service.
Twelve thousand people were estimated to have been inside the basilica, the BBC's Julia Carneiro reports.
Up to 200,000 more were outside watching the service on big screens, our correspondent adds.
After his Mass, the Pope appeared on a balcony to greet the crowds.
A homemade explosive device was discovered at the shrine on Sunday, but authorities said it was "of low power" and not near the area where the Pope and pilgrims will visit.
The Vatican later insisted that the discovery was no cause for concern.
On Tuesday, around 400,000 Roman Catholics joined a ceremony on Copacabana Beach to mark the opening of World Youth Day.
There was transport chaos shortly before the event when the Rio metro system was brought to a standstill for two hours by a power cut.
Crowds of people hoping to attend the Mass were left stranded, while others crammed onto buses and taxis heading to the beach.
Travel chaos also ensued on Monday when the pontiff's car became stuck in one of Rio's infamous traffic jams, after his driver reportedly took the wrong turn and missed lanes that had been cleared by the security services.
Correspondents said Brazil was reviewing security around the pontiff following the incident.
The Pope, who is from neighbouring Argentina, was officially welcomed at the state governor's palace by Brazil's President Dilma Rousseff on Monday.
However police later fired tear gas to disperse people who were demonstrating outside. They were protesting against the government and also against the cost of the papal visit.
More than a million young Catholics are expected to gather in Rio for World Youth Day, which takes place every two years and is a celebration of the Catholic faith.
Some 30,000 army and police are on duty throughout his visit.
25 July 2013 Last updated at 00:25 GMT
Dear Drugs-Forum readers: We are a small non-profit that runs one of the most read drug information & addiction help websites in the world. We serve over 4 million readers per month, and have costs like all popular websites: servers, hosting, licenses and software. To protect our independence we do not run ads. We take no government funds. We run on donations which average $25. If everyone reading this would donate $5 then this fund raiser would be done in an hour. If Drugs-Forum is useful to you, take one minute to keep it online another year by donating whatever you can today. Donations are currently not sufficient to pay our bills and keep the site up. Your help is most welcome. Thank you.