Cardinal Paulo Evaristo Arns, who has died aged 95, used to tell a revealing story about his final interview with Pope John Paul II. It was 1998, and Dom Paulo, as he was known affectionately to his flock in São Paulo, which claims to be the largest Catholic city in the world, was about to retire as an archbishop after 28 years in post. The two senior churchmen were in a room in the Vatican and had been getting on famously when John Paul suddenly produced out of his pocket a farewell letter for Arns, pre-prepared by his officials. “They gave me the text,” he explained, “and I only had to sign it.”

With long experience of the machinations of Vatican bureaucracy, Arns suggested they should look over the text together. “It was very critical of me,” he recalled in a 2002 newspaper interview. “I started to read it to him. When we got to the third paragraph, the pope became indignant and said, ‘I am not going to sign this. I never said this about you, Paulo, and neither do I want it stated in a document.’ He then threw the paper on the floor.”

The incident reveals the high personal esteem in which John Paul held Arns, and hardly fits with the image often presented of the Polish pontiff as hostile to progressive Latin American clerics. But it also illustrates the deep hostility within the Curia to Arns and his ilk. Such hostility was scant reward for their tireless championing of the poor and the marginalised, in line with gospel imperatives, but had its roots in Rome’s dislike for “liberation theology” and its model of a participatory church that dominated Latin American Catholicism in the 1970s and 80s.

When Arns was a young boy, growing up in a humble home in the state of Santa Catarina in the 1920s and 30s, the church in Brazil, one of the most economically divided countries in the world, had always sided instinctively with the ruling elite. As archbishop, then cardinal archbishop, of São Paulo from 1970 onwards, Arns reversed that.

In the Colombian city of Medellín in 1968, at the Conference of Latin American Bishops, he was one of those who signed up for the “preferential option for the poor” that lay at the heart of liberation theology. “I was never,” Arns once said, “in favour of communism or capitalism. [I wanted] a social system where all would have what is sufficient for a decent life and where there would be justice and equality. In our country 2% of the population has more wealth than the other 98%. This is a scandal.”

In his huge, sprawling São Paulo diocese of 15 million souls, Arns set to work with gusto to practise and preach the Medellín message. He horrified traditionalist Brazilian Catholics when he sold the city’s ornate Pope Pius XII archiepiscopal palace, found other employment for the 25 servants he had inherited, and moved instead into a modest couple of rooms behind a monastery, where he would greet visitors, not in his cardinal’s finery but in slippers and a cardigan.

He spent the money raised by the sale on projects to tackle poverty, overcrowding and poor healthcare in the favelas of São Paulo. In his relentless pursuit of justice, Arns quickly became one of the most prominent critics of the military governments of generals Geisel and then Figueiredo over their use of torture, their denial of human rights and their role in the murder of trade union officials. At one point Arns braved a military squadron surrounding the city’s medical institute to retrieve the body of the labour leader Santo Dias da Silva, and witness the bullet holes in his side. He spoke up fearlessly on workers’ pay and conditions, backed strikes that aimed to achieve a living wage, and pressed for the return to democracy that finally came, after 21 years, in 1985.

While his outspokenness made him a hero of the masses and, for many, the most inspirational figure in the Latin American church, it drew a more mixed reaction in Rome. Initially it seemed that John Paul II, elected in 1978, thoroughly approved of Arns. On a visit to Brazil in 1980, the pontiff joined the São Paulo cardinal at a football stadium to urge striking metal workers (who included the future leftist president, Lula da Silva) to continue their fight for justice, to cries of “liberdade, liberdade”. When John Paul addressed the union leader, Waldemar Rossi, as “Comrade Worker”, many noted the clear parallels with the pope’s support for the Solidarity trade union in his native land.

But as the decade progressed, the pope allowed his right-hand man (and ultimately his successor), Cardinal Joseph Ratzinger, to rein in proponents of liberation theology on the grounds that they were mixing up the gospel and politics. In 1984, Arns was publicly humiliated by Ratzinger when the latter refused to allow him to attend a Vatican dressing-down to be given to the Brazilian liberation theologian Father Leonardo Boff. Arns had wanted to defend his fellow Franciscan, but Ratzinger let him into the room only at the end of the interview.

In 1989, Rome further punished Arns by breaking up his power base. His archdiocese was split. He was left with authority only over the middle-class and financial heart of the city – the section of the community most suspicious of his work – while his natural home, the outlying favelas, were reorganised into five new dioceses, each with its own independent bishop.

The collegial model that Arns had implemented in São Paulo archdiocese – with everyone having an equal voice and a vote in deliberations – was abandoned in the new set-up. While Rome realised that Arns was too formidable and celebrated a figure to cross directly, it signalled its disapproval of his work by targeting those close to him, removing his confessor, the Dominican biblical scholar Frei Gilberto Gorgulho, from his posts at the archdiocesan seminary.

In spite of such treatment, Arns pointedly refused to waver in his loyalty to the papacy. In retirement, he confined himself to warnings about the growth of power of the church’s bureaucrats. “The Curia,” he said, “is governing the church.” And, by implication, ruining it.

Born in Forquilhinha, Santa Caterina, Paulo was the fifth of 13 children of poor German immigrants, Helena (nee Steiner) and Gabriel Arns. His first language in childhood was German and it enabled him to later give the German Cardinal Ratzinger as good as he got.

Three of his sisters became nuns and he was one of two of the brothers who joined the Franciscan order. After ordination in 1945, he was sent to the Sorbonne in Paris. There, he studied alongside many who had been detained and tortured by the Nazis. On his return to Brazil, he worked in education – as a professor at the Franciscan seminary at Agudos, which served São Paulo, and then at the Catholic University of Petrópolis – but also ran slum parishes. He was consecrated an assistant bishop in 1966, in time to participate enthusiastically at the Medellín conference.

Soon after his appointment by Pope Paul VI to São Paulo as archbishop in 1970 (he was given his cardinal’s hat in 1973), he was shocked by the arrest and torture of a young diocesan priest. His “crime” had been to write in favour of better wages for workers. When Arns was refused permission to visit the priest in prison, he used church radio stations, newspapers and the pulpit to highlight the activities of the secret police. He was a great believer in the need to communicate effectively the church’s message, writing more than 120 books and building a small radio studio next to his home.

His fight to free one priest broadened into a high-profile campaign against torture. His book on the subject – Brasil, Nunca Mais (Brazil never again, 1985) – was translated into English as Torture in Brazil and widely read.

His good personal relations with John Paul II saw him appointed in 1983 as secretary to the synod of bishops, the regular gathering of the world’s Catholic prelates in Rome. At that 1983 meeting, Arns made headlines by insisting that the theme – Reconciliation and Penance – be taken as indicating not just the need for individuals to confess their sins, but for the church to ask “who confesses the economic sins committed against the third world?”.

Social sin, as it is called, was a key theme of John Paul II, and one of many areas where the two men shared similar views. But the crucial difference was that the Polish pope believed that evangelisation of the marginalised must always come before fighting for their political and social wellbeing.

In retirement, as the resident chaplain at an old people’s home north of São Paulo, Arns continued to speak out – notably for reform of the rule demanding that all priests be celibate. It should simply be an option, he told the newspaper O Globo, since clerical celibacy had little basis in the Bible.

A tumour on his eye and the onset of Parkinson’s disease slowed him down, but he carried on working, holding the Unesco chair for peace education, human rights, democracy and tolerance at São Paulo State University before finally retiring from the public eye into a life of prayer.

The Vatican may have been successful in stripping Dom Paulo of the trappings of power in the church – his suggestions for his successor in São Paulo when he retired were rejected – but no bureaucracy could take away the authority of his prophetic voice in Brazil and in international Catholicism.

• Cardinal Paulo Evaristo Arns, priest, born 14 September 1921; died 14 December 2016