Pontiff says liberal policies being considered in Latin America will not end suffering as he continues first overseas visit

Pope Francis entered political waters on Wednesday with a sharply worded condemnation of moves to legalise drug use.

His comments, which were made during a visit to a rehabilitation centre in Brazil, run counter to a growing movement in Latin America to liberalise sales of marijuana and other narcotics following decades of a murderous and largely ineffectual war against drugs in the region.

"A reduction in the spread and influence of drug addiction will not be achieved by a liberalisation of drug use, as is currently being proposed in various parts of Latin America," the pontiff said. "Rather it is necessary to confront the problems underlying the use of these drugs, by promoting greater justice, educating young people in the values that build up life in society, accompanying those in difficulty and giving them hope for the future."

The pope was visiting the St Francis of Assisi hospital – named after the saint whose name the Argentine adopted as pontiff – in Rio de Janeiro on his first full day of activities since arriving in Brazil.

After listening to stories of addicts undergoing treatment, Francis launched an uncompromising attack on the "dealers of death" who sell drugs. "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.

The pope's words cut to the heart of one of the biggest problems facing Latin America, a region that supplies all of the world's cocaine and has long suffered murderous conflicts between rival trafficking gangs and anti-narcotics security forces.

Government leaders in several countries including Colombia, Bolivia, Ecuador and Guatemala have appealed for a softer line on drugs, arguing that the current tough policy has failed to reduce demand. Next mont, Uruguay's Congress will note on a proposal to decriminalise sales of marijuana in a move that the country's president, Jose Mujica, says is aimed at undermining illegal traffickers.

Francis, however, said the treatment hospital was a "shrine to human suffering" that emphasised the need to confront the scourge of drugs through education, justice and stronger social values.

His message may well be underlined on Thursday when the pope is due visit a favela slum that was recently notorious for drug addiction and gang battles.

Earlier on Wednesday Francis urged Catholics to resist the "ephemeral idols" of money, power, success and pleasure during his first mass in Brazil. He made no direct mention of the inequality and corruption that have sparked nationwide protests.

In a sermon to a congregation of thousands at the Basilica of the National Shrine of Our Lady Aparecida, the pontiff appealed to the faithful to focus on non-material values of spiritualism, generosity, solidarity and perseverance.

"Let us never lose hope! Let us never allow it to die in our hearts!" the pope said in a message that appeared to be aimed at the widespread consumerism that the Vatican has blamed for a decline in spirituality, rather than the specific individuals and institutions targeted by demonstrators in recent weeks.

Francis arrived in a khaki-coloured military helicopter and boarded an open-top popemobile to cheers from a crowd of tens of thousands who braved winter rains for several hours so they could watch on two giant screens outside the basilica. Flanked by a dozen security officials on the short journey from the helipad, the pope experienced no repeat of the chaotic scenes during his arrival on Monday, when his vehicle took a wrong turn and was held up by crowds who pressed up against his car. Rain also appeared to have dampened some of the enthusiasm. The crowds – many carrying umbrellas – were a dozen or so deep and kept at a distance by security barriers.

Vatican officials say the pontiff asked for the mass at the basilica, which is 160 miles (260km) from his base in Rio, to be added to his schedule. Built in 1955 with a capacity of 40,000, the Basilica of the National Shrine of Our Lady Aparecida – the principal patroness of Brazil and a unifying figure for many in the nation's Catholic Church. It is the site of pilgrimage for millions every year who flock to see an apparently dark-skinned statue of the Virgin Mary which, myth has it, was found in two parts by fishermen in 1717.

Francis appeared moved to tears as he said a prayer before the statue. He had visited the site five years earlier at a conference of bishops which helped to raise his standing in the church.

Underscoring the emphasis on humility, hope and simplicity that have become central themes of his papacy, Francis warned that almost everyone was attracted to wealth and pleasure.

"Often a growing sense of loneliness and emptiness in the hearts of many people leads them to seek satisfaction in these ephemeral idols," he said, speaking in Portuguese from a modern marble pulpit.

Professor Padre Erico Hammes of the Pontifícia Universidade of Rio Grande do Sul said Francis's direct and simple speaking style was in marked contrast to the baroque language of his two predecessors. "Pope Francis is taking a populist approach to religion, successfully bringing everyday experience back into the limelight of Catholicism," Hammes said.

Despite concerns from the Brazilian hosts, the pope insisted that his trip should go ahead largely as planned with an open-top – rather than a bulletproof – popemobile and a stop at a favela that was until recently notorious for conflicts between rival gangs. On Wednesday afternoon he was due to visit a drug rehabilitation centre.

This visit comes during a nationwide wave of social protests. A small explosive device was found in Aparecida on Sunday but police and the Vatican said it was unlikely to have constituted a threat to the pope or visiting pilgrims. After the pontiff's arrival in Rio de Janeiro on Monday violent clashes broke out between demonstrators and riot police, who used rubber bullets, teargas and water cannon to disperse crowds close to where the pope had been meeting the country's president, Dilma Rousseff.

Several more protests are planned this week including three related directly to the pope's visit, according to Anonymous social networks that have been calling people to the streets.

Following a meeting to review how the trip was going, Vatican spokesman Father Federico Lombardi said one change had been made: for Francis to ride in a closed car from Rio airport to the drug treatment hospital he visited on his return from Aparecida.