SAO PAULO, Brazil — In the early 1980s, when Pope John Paul II wanted to clamp down on what he considered a dangerous, Marxist-inspired movement in the Roman Catholic Church, liberation theology, he turned to a trusted aide: Cardinal Joseph Ratzinger.

Now Cardinal Ratzinger is Pope Benedict XVI, and when he arrives here on Wednesday for his first pastoral visit to Latin America he may be surprised at what he finds. Liberation theology, which he once called "a fundamental threat to the faith of the church," persists as an active, even defiant force in Latin America, home to nearly half the world's 1 billion Roman Catholics.

Over the past 25 years, even as the Vatican moved to silence the clerical theorists of liberation theology and the church fortified its conservative hierarchy, the social and economic ills the movement highlighted have worsened. In recent years, the politics of the region have also drifted leftward, giving the movement's demand that the church embrace "a preferential option for the poor" new impetus and credibility.

Today some 80,000 "base communities," as the grass-roots building blocks of liberation theology are called, operate in Brazil, the world's most populous Roman Catholic nation, and nearly 1 million "Bible circles" meet regularly to read and discuss Scripture from the viewpoint of the theology of liberation.

During Pope Benedict's five-day visit here, he is scheduled to meet with President Luiz Inacio Lula da Silva, canonize a saint, preach to the faithful and visit a drug treatment center before addressing the opening session of a conference of Latin American bishops that will discuss the future of the church in the region where liberation theology originated, prospered and drew so much of his censure. Some liberation theology supporters will be present, others will be at a parallel meeting, and all have been cautioned not to be too aggressive in pressing their views.

In the past, adherents stood firm as death squads made scores of martyrs to the movement, ranging from Archbishop Oscar Arnulfo Romero of El Salvador, killed in 1980 while celebrating Mass, to Dorothy Mae Stang, an American-born nun shot to death in the Brazilian Amazon in February 2005. Compared to that, the pressures of the Vatican are nothing to fear, they maintain.

"Despite everything, we continue to endure in a kind of subterranean way," said Luiz Antonio Rodrigues dos Santos, a 55-year-old teacher active in the movement for nearly 30 years. "Let Rome and the critics say what they want; we simply persevere in our work with the poor and the oppressed."

On a cool and cloudy Saturday morning in late April, evidence of the movement's vitality was plain to see. Representatives of 50 base communities gathered at the St. Paul the Apostle Church on the east side of this sprawling city, an area of humble workers' residences and squatter slums.

With four priests present, readings from the Bible alternated with more worldly concerns: criticisms of government proposals to reduce pensions and workers' rights under the Brazilian labor code. The service ended with the Lord's Prayer and then a hymn.

"In the land of mankind, conceived of as a pyramid, there are few at the top, and many at the bottom," the congregation sang. "In the land of mankind, those at the top crush those at the bottom. Oh, people of the poor, people subjected to domination, what are you doing just standing there? The world of mankind has to be changed, so arise people, don't stand still."

Afterward, discussion turned to other social problems, chief among them a lack of proper sanitation. A representative of the left-wing Workers' Party discussed strategies to press the government to complete a sewer project. Congregants agreed to organize a campaign to lobby for it.

In other areas here, liberation theology advocates have strong links to labor unions. At a May 1 Mass to commemorate International Labor Day, they draped a wooden cross with black banners labeled "imperialism" and "privatization" and applauded when the homily criticized the government's "neoliberal" economic policies, the kind Washington supports.

"We believe in merging the questions of faith and social action," said Valmir Resende dos Santos, a liberation disciple who brings base communities and labor groups together in the industrial suburbs here. "We advise groups and social movements, mobilize the unemployed, and work with unions and parties, always from a perspective based on the Gospel."

Since liberation theology first emerged in the 1960s, it has consistently mixed politics and religion. Adherents have often been active in labor unions and left-wing political parties and criticized governments they complain are beholden to modern-day Pharisees.

Supporters see that activism as a necessary virtue to answer the needs of the poor. Opponents say it dangerously insinuates the church into the temporal, political realm, and in recent years they have repeatedly announced the movement's decline or disappearance.

Some of the distinctions in this debate are finely drawn. John Paul II's reach extended into human rights and politics, as he discouraged abortion and divorce and encouraged fellow Poles and other Europeans to reject communism. He is widely credited with helping to bring about the eventual collapse of the Soviet Union.

That, some say, differs from the direct, class-oriented political activism embraced by liberation theology. As cardinal, Ratzinger once called the movement a "fusing of the Bible's view of history with Marxist dialectics," and other critics complain of what they see as its emphasis on direct collective action in Jesus' name over individual faith.

As John Paul II put it early in his papacy: "This conception of Christ as a political figure, a revolutionary, as the subversive of Nazareth, does not tally with the church's catechism."

Certainly at the upper levels of the church hierarchy, liberation theology has been forced into retreat. Bishops and cardinals who supported and protected the movement in the 1970s and 1980s have either died or retired, succeeded by clerics openly hostile to such communities and the values they espouse.

"Base communities can only thrive in areas where there are bishops to encourage them," said Margaret Hebblethwaite, a British religious writer whose books include "Base Communities: An Introduction" and "The Next Pope." "If you take away the support of the bishop, it becomes very difficult for them to get anywhere."

But the movement remains especially active in the poorest areas like the Amazon, the hinterlands of northeast Brazil and on the outskirts of large urban centers such as this one, the largest in Brazil, with nearly 20 million people in the metropolitan area. Hoping to draw less attention and opprobrium to themselves, some of these groups simply say they are engaged in a "social pastorate."

Sparring between liberation theologians and Pope Benedict — whose own theology was formed in reaction to the reach of Nazi ideology — has been long and bitter. In 1984, as the Vatican official charged with supervising questions of faith and doctrine, he declared that "the theology of liberation is a singular heresy."

More recently, he said, "it seems to me we need not theology of liberation, but theology of martyrdom" and argued that the movement will become a valid theology "only when it refuses to accept power and worldly logic" and instead emphasizes "inner liberty." But that was when his job was to carry out John Paul's orders, and there is speculation here that his views may have softened somewhat.

That helps explain some of the theological maneuvering that has been going on in Latin America recently.

At the behest of conservatives, the Vatican has imposed sanctions on the liberation theologians Gustavo Gutierrez of Peru, Leonardo Boff of Brazil and, most recently, Jon Sobrino of El Salvador, a Jesuit born in Spain. But when the Vatican admonished Sobrino in March, Pedro Casaldaliga of Brazil, one of the bishops most committed to liberation theology, wrote an open letter calling on the church to reaffirm its "real commitment to the service of God's poor" and "the link between faith and politics."

That drew a sharp rebuke from Felipe Aquino, a conservative theologian whose views are often broadcast on Catholic radio stations here. "In spite of having received the Vatican's cordial warning, you continue to be incorrigible, poisoning the people with the theology of liberation, which, as Ratzinger noted, annihilates the true faith and subverts the gospel of salvation," he wrote.

At a news conference here on April 27, the newly appointed archbishop of Sao Paulo, Odilo Scherer, 57, tried to conciliate the two opposing viewpoints. While he criticized liberation theology for using "Marxism as a tool of analysis," he also praised liberation theologians for redirecting the church's mission here to focus on issues of social injustice and poverty.

He also argued that the movement was in decline. Adherents, however, are less sure.

"The force of Latin America's harsh social reality is stronger than Rome's ideology, so the theology of liberation still has a great deal of vitality," Boff, a former Franciscan friar who left the clergy in 1992, argued in a recent interview. "It is true it doesn't have the visibility it once had and is not as controversial as it once was, but it is very much alive and well."