Pope Benedict urged Cubans on Wednesday to search for authentic freedom and met with revolutionary icon Fidel Castro as he wrapped up a visit in which he said Cuba must change.
The leader of the world's 1.2 billon Catholics led a public Mass in Havana's vast Revolution Square where Castro, 85, once drew huge crowds to listen to his fiery speeches.
Surrounded by ten-story high images of Castro's late comrades Ernesto Che Guevara and Camilo Cienfuegos, the pope read a sermon that continued the main themes of his trip - that Cuba must build a more open, less controlled society, with a bigger role for the Roman Catholic Church as a buffer against trauma or social upheaval.
The Vatican estimated that 300,000 people were in the crowd.
Benedict's visit comes as President Raul Castro has undertaken economic reforms to encourage more private enterprise and embraced the Church as an interlocutor on social issues.
But while Benedict is urging Cuba to make deeper changes, the government sees its reforms as a way of strengthening communist rule, not weakening it.
After the Mass, Fidel Castro, the president's older brother, visited Benedict at the Vatican embassy where the two octogenarian world leaders with widely divergent political views chatted for 30 minutes in what a Vatican spokesman called a very cordial atmosphere.
They discussed serious issues such as Church liturgy and the state of the world, but also joked about their age -- Benedict is 84. At one point, Castro asked a simple question - what does a pope do?
The pope told him of his ministry, his trips, and his service to the Church, said spokesman Federico Lombardi.
Photographs showed Castro and the pope standing and smiling, with Castro wearing a dark track suit with a scarf around his neck that seemed out of place on a warm day.
The friendly meeting contrasted with the beginning of Benedict's visit when he sharply criticized the communist system that Castro put in place after taking power in a 1959 revolution and continues to defend as the last, best hope of mankind.
On the flight to Mexico beginning his Latin American trip on Friday, the pope said communism had failed in Cuba and that the country needs a new economic model.
In a possible dig at Marxism on Wednesday, Benedict also said some wrongly interpret this search for the truth, leading them to irrationality and fanaticism; they close themselves in 'their truth,' and try to impose it on others.
He said the said the search for truth always supposes the exercise of authentic freedom.
Since his arrival on Monday in the eastern city of Santiago de Cuba, Benedict has made thinly-veiled references to Cuban dissidents, political prisoners, Cuban exiles and the need for the Caribbean island to push ahead with its economic reforms.
While he acknowledged with joy the great improvements in Church-state relations since Pope John Paul's 1998 Cuba visit, he added: Nonetheless, this must continue forwards, and I wish to encourage the country's government authorities to strengthen what has already been achieved and advance along this path.
The Church wants to get back some of the ground it lost after the revolution, so the pope urged the government to let it do more social work and play a bigger role in education.
Marino Murillo, a vice president in the Council of Ministers and the country's economic reforms czar, made it clear that change to Cuba's one-party political system is not in the works.
In Cuba there won't be political reform, he said at a news conference. We are talking about the update of the Cuban economic model to make our socialism sustainable.
(Additional reporting by Simon Gardner, Rosa Tania Valdes and Nelson Acosta. Editing by Kieran Murray)