Havana: Fidel Castro laid into Barack Obama after the US president's historic visit to Cuba in a testy letter today, saying the communist island doesn't need any "gifts from the empire."

The 89-year-old leader of the Cuban Revolution, who has reacted tepidly to the communist island's rapprochement with the United States, scoffed at what he described as Obama's call to forgive and forget more than half a century of Cold War enmity.

"Listening to the words of the US president could give anyone a heart attack," Castro, who handed power to his younger brother Raul in 2006, wrote in his first published reaction to the visit.

"My modest suggestion is that he think and not try to theorize about Cuban politics."

Obama, who met Raul but not Fidel Castro during his three-day visit last week, defied the regime's warnings not to wade into Cuba's internal affairs by meeting with anti-Castro dissidents and calling for democracy and greater freedoms.

"Voters should be able to choose their governments in free and democratic elections," he said in a speech carried live on Cuba's tightly controlled state television.

Castro lashed out at that speech, the symbolically charged centerpiece of the first visit by a US president in 88 years.

"Obama gave a speech in which he used the most syrupy words," he wrote, recounting the long history of acrimonious relations between Havana and Washington.

"Nobody has any illusion that the people of this noble and selfless country will surrender glory and rights and the spiritual wealth that has come through the development of education, science and culture," said the retired revolutionary, who led Cuba for 47 years.

"I would also warn that we are capable of producing the food and material wealth we need with the labor and the intelligence of our people. We don't need any gifts from the empire."

Castro remained out of sight during Obama's visit, which aimed to cement the ongoing normalization of US-Cuban ties, first announced in December 2014.