(AP) Pope Francis has honed his leadership skills in one of the most difficult classrooms on the planet: Argentina, where politics has long been a blood sport practiced only by the brave.
Rising through Argentina's Roman Catholic hierarchy in times of dictatorship, capitalist excess, economic crisis and populist fervor, Francis has sought to secure a place for his church in an increasingly modern, secular society.
It might be just the training a pope needs before taking on the problems of the world's 1.2 billion Catholics and helping them recover from scandals over sex abuse and feuding and corruption at the highest levels of the church's hierarchy.
"Buenos Aires is a microcosm of the world's problems. He's going to have to deal with political crises and we have political crises here. This is a scale model of the world's inequality," his former spokesman, Guillermo Marco, told The Associated Press.
"On top of that we have drug and insecurity problems, but we also have wonderful people, we're passionate, we're prone to fighting .... Bergoglio is all that!"
As Buenos Aires archbishop, Jorge Mario Bergoglio provided an outspoken counterpoint to the ever-more concentrated power of President Cristina Fernandez.
With the president's key supporters putting dictatorship-era officials on trial for human rights violations like never before, Bergoglio drew a line against blaming the church as a whole for the key support that Catholic leaders provided to the murderous 1976-1983 junta.
"The church was, is and will be persecuted," Bergoglio said from the pulpit during a particularly tense phase in 2007, before a police chaplain was given a life sentence for junta-era tortures and killings. "The methods were and are the same: disinformation, defamation and calumny."
During his sermons at Mass, Bergoglio showed deep disdain for political corruption and unbridled capitalism. When the economy crashed in 2002 and Argentina's politicians seemed incapable of containing social unrest, or when people suffered from acts of terror or other tragedies, he took strong stands in public on behalf of the people.
Meanwhile, behind the scenes, Bergoglio became a skilled operator, welcoming politicians from all sides into his office and offering his opinions on matters having more to do with state than church.
"The Argentine political opposition always found Bergoglio willing to chat," said Washington Uranga, an expert on religious issues and columnist for Pagina 12, a newspaper that closely reflects government thinking.
"His office has been visited by innumerable political leaders, (and) Bergoglio acted like a political strategist who measures his steps and actions," Uranga said.
Marco, the former spokesman, said Bergoglio sees politics as a duty: He maintains his serenity and is open to getting advice, "but never runs away from conflict."
As a Jesuit leader who spent his entire career outside the Vatican, Bergoglio has seen real-world conflicts first hand.
At the height of the country's economic meltdown, Bergoglio got fed up at hearing politicians pointing fingers at each other while the jobless stormed supermarkets desperate for food. He made headlines by writing that "Argentina looks ever more like a funeral procession where everyone wants to console the family but no one wants to carry the dead."
He also won wide acclaim for standing with the survivors and blaming political corruption for Argentina's mass tragedies, such as a nightclub fire that killed 194 people or a commuter train accident that killed 51. "We can't afford to be idiots, fools, towards those who sponsor the culture of death," he said.
Another pope with a personal touch, John Paul II, campaigned to bring down the Cold War's Iron Curtain. Today's challenges have more to do with poverty, inequality and corruption, and Francis has seen it all.
"He wasn't living in a separate house protected by bodyguards, or riding in a car with tinted windows, aloof to reality. No. He lived that reality," Marco said. "If the subway was late, he was late. He took a bus like everyone else and heard the protests, because people would recognize him on the streets and would say, 'Do Something!'"
The challenge is to respond to Argentina's "social debt without stoking new exasperations and polarizations," he said in 2010. "We have to overcome the constant state of confrontation that deepens our ills. The homeland is a gift; the nation, a duty. We have to pray for the prudence of its authorities and the austerity of its citizens, so we can live in peace."
His clashes with Fernandez and her late husband and predecessor, President Nestor Kirchner, became evident in 2004. Every May 25, Argentina celebrates it declaration of independence and church leaders deliver a "Te Deum" address describing what's wrong with society. Political leaders traditionally sit in the front row.
But the Kirchners took it personally that year when Bergoglio publicly questioned "the exhibitionism and strident announcements" of those in power. They never came back.
With popular backing and in clear defiance of the church, they pushed for mandatory sex education in schools, free distribution of contraceptives in public hospitals, and the right for transsexuals to change their official identities on demand. Argentina became the first nation in Latin America to legalize same-sex marriages.
Fernandez's slogan became "we're going for more."
Bergoglio responded in kind.
In last year's address, he said Argentina was being harmed by demagoguery, totalitarianism, corruption and efforts to secure unlimited power: a strong message in a country whose president has ruled by decree and left scandals unpunished.
"He's not looking for conflicts, but he doesn't avoid them. His language is direct and plain. From that perspective, he doesn't act like a diplomat," said Rosendo Fraga, an analyst with the New Majority consulting firm. "He knows how to conciliate, gather strength and look for meeting ground."
That's difficult in highly polarized Argentina. Gabriela Michetti, an opposition lawmaker who considers Francis her spiritual guide, said that every time he would speak about poverty, or the need to cool tempers, he was talking to all Argentines. But the Kirchners saw them as direct attacks.
"Kirchner branded him as the big opposing force, but Bergoglio didn't like that, because he wanted to be seen as a pastor and not a politician," said Michetti.
Others say Bergoglio was born for politics.
"Bergoglio likes politics more than 'dulce de leche' (Argentine caramel)," said Ignacio Fidanza, an analyst at lapoliticaonline.com.
"Bergoglio is always sending signals of an austere church, one that rejects ostentation, and he does it like politicians do it: through words and gestures, successfully, because his actions have an impact," Fidanza added.
Bergoglio also is familiar with the byzantine nature of Vatican politics, having served in three important Vatican congregations since he became a cardinal in 2001. But he seemed less than critical of its shortcomings, even after internal turf battles, intrigue and allegations of corruption emerged in leaked papal documents.
Those revelations featured heavily in the conclave that elected Francis pope, with cardinals particularly from the U.S. insisting that the new pontiff must clean up the mess within the Vatican's own walls to restore credibility to the church as a whole.
Reform of the bureaucracy is a major task ahead for Francis to make the Holy See more responsive to the needs of the church in the field and more governable at home, since it currently operates like a collection of independent fiefdoms where the right hand doesn't know what the left is doing.
In a 2012 interview with veteran Italian Vatican journalist Andrea Tornielli, Bergoglio acknowledged that the church is both "saint and sinner," but that one cannot allow the sins to overshadow "the saintliness of so many men and women who operate in the church."
"The Roman Curia has its defects, but it seems that what is being highlighted is the bad and not the good being done by the lay and consecrated men and women who work there," Bergoglio said.
It was a message not unlike his position on the dirty war, which has left the new pope open to criticism that he cares more about protecting the image of the church than exposing its failings.
Associated Press writers Michael Warren and Almudena Calatrava in Buenos Aires, Argentina, and Nicole Winfield in Rome contributed to this report.
Luis Andres Henao on Twitter: https://twitter.com/LuisAndresHenao