Argentina was on the verge of approving gay marriage, and theRoman Catholic Church was desperate to stop that from happening. It would lead tens of thousands of its followers in protest on the streets of Buenos Aires and publicly condemn the proposed law, a direct threat to church teaching, as the work of the devil.
But behind the scenes, Cardinal Jorge Mario Bergoglio, who led the public charge against the measure, spoke out in a heated meeting of bishops in 2010 and advocated a highly unorthodox solution: that the church in Argentina support the idea of civil unions for gay couples.
The concession inflamed the gathering — and offers a telling insight into the leadership style he may now bring to the papacy.
Few would suggest that Cardinal Bergoglio, now Pope Francis, is anything but a stalwart who fully embraces the church’s positions on core social issues. But as he faced one of the most acute tests of his tenure as head of Argentina’s church, he showed another side as well, supporters and critics say: that of a deal maker willing to compromise and court opposing sides in the debate, detractors included.
The approach stands in sharp contrast to his predecessor,Benedict XVI, who spent 25 years as the church’s chief doctrinal enforcer before becoming pope, known for an unbending adherence to doctrinal purity. Francis, by comparison, spent decades in the field, responsible for translating such ideals into practice in the real world, sometimes leading to a different approach.
“The melody may be the same, but the sound is completely different,” Alberto Melloni, the director of the liberal Catholic John XXIII Foundation for Religious Science in Bologna, Italy, said of the two.
Faced with the near certain passage of the gay marriage bill, Cardinal Bergoglio offered the civil union compromise as the “lesser of two evils,” said Sergio Rubin, his authorized biographer. “He wagered on a position of greater dialogue with society.”
In the end, though, a majority of the bishops voted to overrule him, his only such loss in his six-year tenure as head of Argentina’s bishops’ conference. But throughout the contentious political debate, he acted as both the public face of the opposition to the law and as a bridge-builder, sometimes reaching out to his critics.
“He listened to my views with a great deal of respect,” said Marcelo Márquez, a gay rights leader and theologian who wrote a tough letter to Cardinal Bergoglio and, to his surprise, received a call from him less than an hour after it was delivered. “He told me that homosexuals need to have recognized rights and that he supported civil unions, but notsame-sex marriage.”
Mr. Márquez said he went on to meet twice with Cardinal Bergoglio, telling him of his plan to marry his partner and discussing theology. The man who would become pope gave him a copy of his biography, “The Jesuit.”  
Cardinal Bergoglio’s readiness to reach out across the ideological spectrum and acknowledge civil unions for gay people could raise expectations that he would do the same as pope. But some of this strategic flexibility may have stemmed as much from Francis’ position at the time as from his personal ideology.
Though Benedict publicly condemned legal recognition of unmarried heterosexual couples, much less gay couples, there was often an expectation of some discretion in putting his positions into practice.
While the pope in Rome issued the doctrine, bishops like Cardinal Bergoglio were “on the frontier, in the field,” and had to contend with the complexities of local politics, said Sandro Magister, a Vatican expert for the newspaper L’Espresso in Italy.
Mr. Magister noted, for instance, that Benedict made it clear in 2005 that divorced Catholics who had remarried without an annulment should not receive communion. But Benedict did not instruct bishops how to enforce that, he said.
There was little ambiguity in Cardinal Bergoglio’s vehement opposition to the gay marriage law, which was approved by the Senate in July 2010. In the months between the bishops’ meeting and the Senate vote, the cardinal, in a letter, called the bill a “destructive pretension against the plan of God.”
Clashing with Argentina’s president, Cristina Fernández de Kirchner, who supported the law, he endorsed protests involving tens of thousands of people against the bill, incurring the ire of some gay rights leaders here.
“The reality, beyond what he may have said in private meetings, was that he said some terrible things in public,” said Esteban Paulón, president of the Argentine Federation of Lesbians, Gays, Bisexuals and Transsexuals. “He took a role, in public, that was determinedly combative.”
But others who observed the bishops’ private annual assembly in 2010 said that the cardinal was earnestly hoping for compromise on the issue.
“Bergoglio’s thinking was very clearly demonstrated both with what he said and in the message of his pastoral work,” said Roxana Alfieri, a social worker in the communications department of the bishops’ central office here.
“He didn’t want the church to take a position of condemning people but rather of respect for their rights like any vulnerable person,” said Ms. Alfieri, who sat in on the bishops’ 2010 meeting.
Cardinal Bergoglio was operating in one of Latin America’s most socially liberal countries. Though Roman Catholicism remains the official religion of the state and 76.8 percent of Argentina’s population is Catholic, only 33 percent cited religion as very important in their lives, according to a 2010 Pew study, and just 19 percent said they regularly attended mass.
While the archbishop’s support for civil unions was shared by some of the more liberal bishops in attendance, it was defeated by the majority, reflecting the broad resistance of conservative bishops.
One priest in the province of Córdoba who spoke publicly in favor of the gay marriage measure, the Rev. Nicolás Alessio, was suspended from his work by another archbishop, Carlos Ñáñez. In an essay written after the election this month of Pope Francis, Father Alessio continued to speak out on the subject, calling Argentina a “model for the rest of the continent” on gay rights.
 Nearly three years since the passage of the law, more than 1,000 gay and lesbian couples have married in Argentina, and specialized tourism for gay and lesbian travelers has grown here, with about 50 tourist couples also taking advantage of the right to marry.
“This is something Rome cannot forgive, tolerate or allow to advance,” Father Alessio wrote.
Rachel Donadio contributed reporting from Rome, and William Neuman and Jonathan Gilbert from Buenos Aires.