Pope Benedict XVI has criticised "authoritarian governments" in Latin America, in a speech at the end of his five-day tour of Brazil.
The Pope projected an image of both firmness and gentleness
He condemned the growing gap between rich and poor, blaming both Marxism and capitalism for the region's problems.
The speech opened a conference to discuss ways to counter evangelical Protestants in Latin America, who have won over millions of former Catholics.
The Pope has now left the country to fly back to Rome.
"The demonstrations of enthusiasm and deep piety of this generous people will remain forever etched in my memory," he said, before boarding an Alitalia plane.
The BBC's David Willey, who has been travelling with the Pope, says he managed to project an image of both sternness and gentleness during his trip.
A leading Sao Paulo newspaper said the image of a cold conservative had been replaced by that of a smiling pope who speaks the language of the poor, who kisses the faithful and embraces multitudes.
But although about 200,000 people attended Pope Benedict's final Mass near Sao Paulo, it was less than half the number predicted by Church officials.
Analysts say the low turnout reflects the waning influence of the Church and the weaker star appeal of this Pope, compared to his predecessor, Pope John Paul II.
'Illusions of happiness'
In his opening address to the two-week bishops' conference, the Pope attacked unnamed governments in Latin America that he said were "wedded to old-fashioned ideologies which do not correspond to the Christian vision of man and society".
He warned that the worsening gap between rich and poor was causing a loss of dignity through drugs, alcohol "and deceptive illusions of happiness".
"Capitalism and Marxism promised to find the right path towards the creation of just institutions and they claimed that those, once established, would function on their own," he said.
"They also claimed that not only would there be no need for an individual moral conscience, but that they would provide a common morality. This ideological promise has been shown to be false."
The Pope did not name any countries in his criticism of capitalism and Marxism, but the region has seen a sharp move to the left in recent years - with the election of leftist leaders in Bolivia, Ecuador and Nicaragua and the re-election of President Hugo Chavez in Venezuela.
Benedict urged the bishops to do more to confront the challenges facing the Catholic Church in the region.
The issue of attracting or keeping faithful, and the shortage of priests in the region, will be high on the agenda at the conference, which brings together 169 bishops from across Latin America.
The rise of evangelical churches and the Vatican's traditional conservative stance on social issues are among the key obstacles to reviving the attraction of the Catholic Church in Latin America, correspondents say.
In 2000, 74% of Brazilians were Catholics, compared to 89% in 1980. Many turned to evangelical Protestant faiths, which now make up 15% of the population.