Francis spoke at Mass at Cuba's holiest shrine, with President Raul Castro attending. His choice of words carried particular weight in a country whose 1959 revolution installed an atheist, communist government that sought to replace the church as the guiding force in people's live.
Around midday, he left for Washington for a visit in which he will meet with President Barack Obama, address Congress and the United Nations and take part in a Vatican-sponsored conference on families in Philadelphia.
At his Sunday Mass in Havana, he urged thousands of Cubans to serve one another and not an ideology. He also encouraged them to refrain from "looking to one side or the other to see what our neighbor is doing or not doing," words that resonated in a nation where the government controls most aspects of life.
Some 10 percent of Cubans regularly celebrate Mass, and the church has been trying to seize on the softening of the Cuban system under Raul Castro to rekindle the country's religious heritage.
Also Read
The pope spoke in the foothills of the Sierra Maestra mountains where Castro and his brother Fidel commanded a guerrilla army that swept through the country and seized power in 1959.
After decades of official hostility to the church, the government has been gradually giving it space to operate in recent years, handing it back churches to reopen and allowing priests to run education programs and extensive outreach to the poor, sick and elderly.