As Archbishop of Buenos Aires, Bergoglio quadrupled the number of priests serving in the slums. He became concerned not just with holy water but also with water pressure in the municipal pipes, one of those priests told me. He backed self-help groups, cooperatives and unions, exactly the kind of work he tried to kill off 20 years before.

A changing world changed him even more. Argentina’s military dictatorship was overthrown, and democracy returned in 1983. With the collapse of communism in Europe several years later, the Catholic Church lessened its hostility to liberation theology. That antipathy was once so strong that it cooperated with the CIA, which supplied information about hundreds of radical priests and nuns, many of whom were later killed, to Latin America’s military dictatorships.

Against the background of those changes, Bergoglio began to see the underlying economic structures — like the corrupt financial systems that keep people poor — as what liberation theology calls structures of sin. He shifted from seeing the world through the lens of charity to one of social justice. He began to adopt the vocabulary of liberation theology.

When Argentina underwent the biggest debt default in world banking history, in 2001, half the population was plunged below the poverty line. Austerity measures intended to solve the country’s macroeconomic problems made life for the poor intolerable, and he spoke about the crisis in the language of a fully committed liberation theologian. “No one can accept the precepts of neoliberalism and consider themselves Christian,” he wrote.

Bergoglio wrote critically about communism in the past but now he set out to question the unchallenged dominance of capitalism. He led a meeting of Latin American bishops in Brazil in 2007, where they produced a new approach merging some of the key principles of liberation theology with the popular piety he so valued.

Just six months after he became pope in 2012, he welcomed the founding father of liberation theology, the Rev. Gustavo Gutiérrez, once viewed with suspicion by the church, as a guest at the Vatican. Summing up the change, Cardinal Gerhard Müller, the chief doctrinal watchdog in the Catholic Church, announced that liberation theology should “be included among the most important currents in 20th century Catholic theology.”

All this sets the background for the pope’s recent anti-capitalist pronouncements. In his papal manifesto, “Evangelii Gaudium,” he wrote that trickle-down economics have done little for the poor and that “worship of the ancient golden calf has returned in a new and ruthless guise in the idolatry of money.”

In his encyclical on the environment, “Laudato si’,” he specifically criticized rich countries for exploiting the resources of the poor. Global warming is merely a symptom of a deeper malaise, he told his aides the day the document was published, explaining that the rich world’s exploitation of the environment is rooted in the same worldview as its callousness toward the poor. Both, he said, are symptoms of a greater ill: the pursuit of short-term economic profit at the expense of people and the planet. “This economy kills,” “Laudato si’” concluded bluntly.

During a trip to Bolivia this summer, Francis delivered his most ferocious denunciation to date. Behind all the “pain, death and destruction” wrought by unrestrained global capitalism, there lurks “the stench of the dung of the devil,” he said. “Let us not be afraid to say it,” he told a gathering of activists. “We want change, real change, structural change. This system is now intolerable.”

When the pope speaks to politicians in the richest nation on earth Tuesday, he will not leave all this behind. Perhaps his rhetoric will be less fierce. But as one shantytown resident told me, wherever in the world Francis goes, “he takes the mud of the slums with him on his shoes.”

Paul Vallely is the author of “Pope Francis: The Struggle for the Soul of Catholicism.”