President Luiz Inacio Lula da Silva of Brazil has left Cuba after a potentially controversial visit.
Lula and Castro are old friends
The Brazilian leader, who has known Cuban leader Fidel Castro for more than 20 years, had been criticised for making the trip.
It came at a time when Cuba faces international condemnation for jailing dissidents, and when Brazil is seeking better relations with Cuba's arch-enemy, the United States.
During the visit the Brazilian president, widely known as Lula, steered clear of politics and focused on economic relations and cooperation agreements.
"It was the best visit that we've ever had," Mr Castro said as he saw off his friend at Havana airport.
The BBC's Stephen Gibbs in Havana say that for his part, Lula can be confident that he has managed to spend 24 hours on the island without saying much that might offend either his host or the United States - Brazil's main trading partner.
However some had hoped for more from the visit, our correspondent adds.
Relatives of the 75 opposition figures that Cuba recently imprisoned had urged Lula to draw on his friendship with President Castro and intervene. Publicly, at least, he did not.
Aides to the Brazilian president say that this was primarily a business trip.
A large team of executives accompanied him and signed a series of accords with their Cuba counterparts.
These clear the way for $400m of Brazilian credit to be made available.
During this visit, Cuba showed itself sensitive to its guest's delicate position by keeping things low key - no flag waving children were laid on.
Fidel Castro's one speech on the same platform as Lula was noticeable for its lack of anti-American rhetoric.
He delivered it wearing a suit, not his traditional military fatigues.
Lula said before he arrived that he would not discuss concerns about Cuba's human rights record.
"I don't give opinions about the internal political conditions of other countries," he told reporters in Mexico this week.
Lula made many trips to Havana when he was a trade-union leader fighting military dictatorship in Brazil in the early 1980s.