HAVANA (Reuters) - Baptized as Roman Catholics and educated by Jesuits, Fidel and Raul Castro turned against the Church by declaring Cuba an atheist state, chasing out priests and shutting down religious schools after seizing power in a 1959 revolution.
In their old age, however, they have brought the Church in from the cold and are gracious and experienced hosts for regular papal visits.
When Pope Francis lands in Cuba on Sept. 19, he will be the third pontiff in a row to visit the Communist-run island.
His three-night stay highlights the new relationship between Church and state in Cuba and a marked softening of the Castros' stance toward the religion they grew up with and then fought.
In return, the Church has become less confrontational and it played a major role in securing last year's rapprochement between Cuba and the United States.
It still wants the return of Church properties occupied after the revolution but it has adopted a strategy of maintaining a fluid dialogue with the government rather than risking conflict.
Fidel Castro, 89 years old and retired, has repeatedly praised Christian values and counts as a close friend the Brazilian priest and intellectual Frei Betto.
Raul Castro, 84 and his brother's successor as president, has gone even further, opening talks with Church leaders inside Cuba and making concessions such as freeing dozens of political prisoners and allowing religious processions.
The Church has supported Castro's efforts to reform the Soviet-style command economy and Pope Francis personally acted as mediator when Cuba and the United States agreed to put aside their Cold War-era hostilities.
Raul Castro met Francis earlier this year in Rome and said he was impressed with his "wisdom and modesty."
"If the pope continues to talk as he does, sooner or later I will start praying again and return to the Catholic Church, and I am not kidding," Castro told reporters.
The comment raised eyebrows around the world and nowhere more than in Cuba, where the Church responded with caution.
"I haven't heard that they have returned to the Church, but people evolve quite a bit during their lives," said Dionisio Garcia, the archbishop of Santiago de Cuba and president of the Cuban Bishops' Conference.
He pointed to the fuller religious freedoms in Cuba.
"Things have improved for all religions. I believe the state's mentality has changed. There is more tolerance at the moment for religious practices. Not everything one would want, but it has changed for the better," Garcia said.
The Church acknowledges it has made great progress in Cuba, especially since breakthrough negotiations in 2010 that resulted in the release of 75 political prisoners.
"Dialogue will continue and should continue but not necessarily based on demands and claims of privilege for the Church. It's enough that, once and for all, the place and the mission of the Church in society and in its relations with a secular state be recognized," spokesman Orlando Marquez said.
SLOW CHANGE
Pope John Paul made a historic visit to Cuba, the first by any pontiff, in 1998 and Pope Benedict followed in 2012. Both met with the Castro brothers.
Those visits showcased and gave momentum to a slow and cautious process of change in Cuba since the end of the Cold War.
While Cuba's government still harasses dissidents and has no intention of breaking the dominance of the Communist Party or allowing multi-party elections, it has released many of the more high-profile peaceful opponents from long prison terms, a process helped by the Church's nudging.
The government has also sought to improve ties with moderate Cuban-Americans and more changes are expected now that it has renewed diplomatic relations with the United States after decades of hostility.
The Church is a clear beneficiary. Christmas became a public holiday again in Cuba after Pope John Paul's visit and Easter after Pope Benedict was here. Two new churches are being built, one in Havana and one in the western province Pinar del Rio, for the first time since 1959.
Despite their softer tone, many experts say the Castros are simply practicing realpolitik rather than experiencing a spiritual awakening.
In 1959, a majority of the clergy in Cuba were Spanish and deeply conservative so a rift was inevitable when Fidel Castro's rebels overthrew dictator Fulgencio Batista.
"They were imbued with anti-communism from the Spanish civil war. They sided with the United States and supporters of the old Batista regime and so the trouble began as a political, not religious, confrontation," said Enrique Lopez Oliva, a historian of religion at the University of Havana.
"Yes, the Castros have changed, but so has the Church, and that is why reconciliation is now possible," he said.
The Castros both claim that the lessons of Christ's life and socialism are compatible.
"If people call me Christian, not from the standpoint of religion but from the standpoint of social vision, I declare that I am a Christian," Fidel Castro said in an oral autobiography with journalist Ignacio Ramonet, published in 2006 shortly before illness forced him to hand over power to Raul.
Lopez Oliva said the Castros changed their stance to help shore up support in the 1990s when the fall of the Soviet Union triggered a deep economic crisis and political isolation. In 1991, the Communist Party dropped its ban on believers in its ranks.
"The Church is the largest non-governmental organization in Cuba and still has a significant following," he said. "They needed the Church for legitimacy and as a mediator internationally and domestically."