ROME– Regardless of who prevails in the US election today, many observers forecast a rocky relationship ahead with the Vatican. If it’s Hillary Clinton, there may be tensions around life issues and religious freedom; if it’s Donald Trump, immigration, the environment and protection of the poor all loom as potential flash points.

Yet for Pope Francis, generally regarded as a savvy politician, that won’t be anything new: First as a Jesuit superior, then as a leading prelate of his native Argentine church, he’s got a lifetime of experience dealing with difficult leaders.

Ahead of today’s result, it’s worth looking at how Francis has navigated tense political situations back home.

The young Jesuit provincial vs. the military regime

Back in 2013, the early euphoria over Pope Francis, who became an instant media star, was leavened to some extent with reports of his alleged collaboration with Argentina’s last military dictatorship. By now, however, those rumors have largely been laid to rest.

It’s been thoroughly documented that during the 1976-1983 dictatorship that led to thousands of desaparecidos, meaning, people kidnapped, tortured and killed by the regime and the police, then- Father Jorge Mario Bergoglio had his own version of “Schindler’s list”.

Months after his election, Italian journalist Nello Scavo published a book titled Bergoglio’s List, documenting multiple cases in which the future pope had secretly helped victims of the military regime, at times at the risk of his own life.

Bergoglio, Scavo writes, saved as many as a thousand targets of the military dictatorship by providing shelter in a Jesuit college, passing them off as seminarians or laity on retreat, then helping them move out of Argentina. He even cites a time in which the future pope gave his own passport to someone to make his escape.

Argentine journalist and historian Armando Ruben Puente, in the book I, Argentine, in which he explores the pontiff’s national roots, documents Bergoglio’s talks with Emilio Massera and Jorge Rafael Videla, two of the three leaders of the military junta that deposed President Isabel Martínez de Perón and ruled Argentina de facto during the National Reorganization Process.

With his insistence, Puente writes, Bergoglio managed to get two Jesuit priests who had been kidnapped, released.

In other words, Pope Francis at an early age managed the fine art of engaging power without approving it, and also resisting it without making things worse.

Auxiliary bishop of Buenos Aires vs. President Carlos Menem

Menem, who ruled the country during the 90s, was a close friend of the then-Archbishop of Buenos Aires Cardinal Antonio Quarracino, who hand-picked Bergoglio as his successor and had him named coadjutor archbishop in 1997.

Yet during Menem’s second term, Quarracino and most of the Argentine bishops raised their voices against the government’s corruption levels — which had its tentacles in the Catholic hierarchy too — and growing poverty and unemployment.

Even though he was very close to his predecessor in Buenos Aires, when Bergoglio took over, and even during the previous months when Quarracino ended his two-time tenure as head of the local bishop’s conference, the changing Catholic hierarchy made it clear: Menem’s strong pro-life stance, which had worked both with the ailing cardinal and the Vatican, was not going cut it in terms of getting a blank check.

Under Bergoglio’s influence, the bishops became more consistent in their criticism of the government’s neoliberal policies and their social effects, which for almost a decade made the rich richer and the poor poorer.

In addition, Bergoglio has spoken about government officials during those years trying to buy him off and of attempting to use the church to launder money by declaring X amount in donations but actually donating half and keeping the rest.

On May 25, 1999, Bergoglio led the first Te Deum in the Buenos Aires Cathedral, a ceremony marking the country’s revolution for independence. The presence of the president was mandatory, if not by law, then by tradition.

Sitting in the first pew, Menem had to listen to Bergoglio’s appeal for a “resurrection” of Argentina, which he claimed had gone numb, focused on superficial things while social divisions grew, “where only a few benefit and the social fabric is destroyed, where the gaps grow,” generating a society bound to confrontation and prone to repeat the fratricidal mistakes of the past.

He accused politicians of not facing problems but only addressing them with words, and called for the people to raise up to the challenge.

To sum up, during that first Te Deum, traditionally seen as a thanksgiving ceremony of consensus, when the church and the state came together to celebrate the nation, the rising star of the Argentine Catholic hierarchy changed the rules by challenging the government on behalf of the people.

As Crux’s contributing editor Austen Ivereigh put it in his papal biography The Great Reformer, Begoglio’s message was clear: “With God’s blessing came accountability.”

A year later, when the man in the first row was Fernando de la Rúa, who succeeded the Peronist Menem with a coalition government, the message was similar, with the future pope warning of mistrust in the system having spread through society.

De la Rúa’s government would eventually be overturned by a social revolt in December 2001, which included street protests, looting and general strikes. The church, led by Bergoglio, attempted to form a dialogue table between the government, the opposition and different social sectors, but failed.

Close to 40 people died across the country during a two-day revolt as a consequence of police repression. A social, economic and political crisis followed, with the country having five sworn presidents in one week.

Through it all, Bergoglio managed both to keep lines of communication open while also keeping up the heat for reform.

The primate of the Argentine church vs. the Kirchners

Fast-forward several months, and along came Nestor Kirchner and his wife, Cristina Fernandez. Between the two, they ruled the country for 12 consecutive years.

Traditionally, one of the first things the newly elected president did was go through Buenos Aires’s main square, the famed Plaza de Mayo, which divides the government house from the cathedral, to greet the cardinal.

The Kirchners refused. As a result, meetings of the three alone were rare.

For over a decade there was a rift between the national governments of Nestor and Cristina Kirchner and Bergoglio, with the presidents refusing to attend the Te Deum celebration in Buenos Aires.

Nestor Kirchner called Bergoglio the “spiritual leader of the opposition,” and the distance between church and government grew so much that a spokesman for the cardinal once declared the two had “no relationship.”

Under Christina Kirchner, the legalization of gay marriage in 2010, which a senator aligned with Fernandez openly defined as “a victory against Bergoglio,” was yet another motive for tension. He called the law “the devil’s handiwork,” while she defined his views as “medieval.”

In 2012, during the last Te Deum he headed before being elected pope, Bergoglio denounced that no one “takes ownership” of the “crimes, tragedies, heavy debts we [Argentines] have to pay for cases of corruption.”

A year earlier, Bergoglio’s homily had focused on reconciliation, calling his country to follow the path of those who “fought for the nation beyond their differences.”

Although often portrayed solely as attacks on Kirchner, the cardinal’s words during these religious ceremonies were destined for the Argentine society as a whole, and to those who at the time were members of the opposition, such as current President Mauricio Macri, who as mayor of Buenos Aires often attended the service.

“All of us, from our responsibilities, must put the nation on our shoulders, because time is running short,” he said once. “We don’t have to wait for everything from those who govern us.”

Behind closed doors, the cardinal met with many members of both Kirchner’s governments. They claimed to govern for the poor, and often insisted on their opposition to abortion as an olive branch, but as had happened during Menem’s years, Bergoglio wanted accountability, something the left-wing government wasn’t willing to give.

As a result, Bergoglio continued to speak of growing inequality and marginalization, the advance of organized crime, the tragedy of drugs, and that the nation was being sold to foreign interests, issues that are still today central in many of his addresses.

The relationship between the latter Kirchner and Bergoglio changed when he was elected pope. She’s traveled to Rome several times, and met with him during two of his trips to Latin America.

However, Gustavo Vera, a politician close to Francis, recently speculated the pontiff had been welcoming towards her because he feared a “political strike” against her, in a country where only a handful of presidents were able to finish their terms in the last 100 years.

That, perhaps, is the final political lesson Francis’s Argentine experience has taught him: Even if a given politician may not be your personal cup of tea, your own interests have to be subordinate to those of the church and the society.