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. "But we also have wonderful people, we're passionate, we're prone to fighting .... Bergoglio is all that!"
With Argentina's justice system putting dictatorship-era officials on trial for human rights violations like never before, the Buenos Aires archbishop 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," Jorge Mario 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."
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.
President Cristina Fernandez and her allies saw that as a threat, political analysts say, but Marco said Francis sees politics as his duty, and "never runs away from conflict."
When the country's economy collapsed in 2002, Bergoglio got fed up at the politicians pointing fingers 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, toward 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. 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 the "social debt without stoking new exasperations and polarizations," Bergoglio 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 its declaration of independence, and church leaders deliver a "Te Deum" address challenging society to do better. Political leaders traditionally sit in the front row.
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," Michetti said.
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 is familiar with the Vatican's byzantine politics, having served in three important congregations since becoming 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. U.S. cardinals in particular insisted that the new pontiff must clean up the mess within the Vatican's own walls to restore credibility to the church as a whole.
Reforming the bureaucracy could make the Holy See more responsive to the needs of the church in the field and more governable at home. It now 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 said one cannot allow the sins to overshadow "the saintliness of so many men and women who operate in the church."
It was a message not unlike his position on the church's actions during the Argentine junta's "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.
"The Roman Curia has its defects," Bergoglio said, "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."
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