The mood in Havana was somber the morning after Fidel Castro died. Just 90 miles away in Miami, the scene was much different. (Jason Aldag/The Washington Post)

Just as they were during the long and sprawling life of Fidel Castro, global leaders were divided Saturday over the legacy of the late Cuban revolutionary leader, with some hailing him as a liberator and others cursing him as a dictator.

Castro’s enemies have long imagined that his death would potentially produce a crisis on the island. But the government has had years to prepare for Castro’s death. Ill health forced Castro to renounce his executive functions in 2006, and his brother, Raúl, 85, has been running Cuba since then.

Castro, who struggled for years with a mysterious ailment, prepared his people for his approaching death in April, while addressing the Communist Party of Cuba.

“I’ll be 90 years old soon,” Castro told his comrades. “Soon I’ll be like all the others.”

In the speech, Castro defended his legacy: “The time will come for all of us, but the ideas of the Cuban Communists will remain as proof on this planet that if they are worked at with fervor and dignity, they can produce the material and cultural goods that human beings need, and we need to fight without a truce to obtain them.”

Castro defied the will of 10 U.S. presidents before President Obama held out an olive branch this year that included a visit to Cuba and a resumption of travel from the United States. American tourists are now pouring in; there are direct flights from Miami.

President-elect Donald Trump, who has been critical of the normalization of relations with Cuba, responded early Saturday with a succinct tweet: “Fidel Castro is dead!”

He later issued a news release, calling Castro a “brutal dictator who oppressed his own people for nearly six decades,” and that his legacy is “one of firing squads, theft, unimaginable suffering, poverty and the denial of fundamental human rights.”

Trump said that he hoped the Cuban people could now move to a future of freedom.

“Though the tragedies, deaths and pain caused by Fidel Castro cannot be erased, our administration will do all it can to ensure the Cuban people can finally begin their journey toward prosperity and liberty,” Trump said.

Obama seemed to take the middle path. “We know that this moment fills Cubans — in Cuba and in the United States — with powerful emotions, recalling the countless ways in which Fidel Castro altered the course of individual lives, families, and of the Cuban nation. History will record and judge the enormous impact of this singular figure on the people and world around him,” the president said in a statement.

In the wake of Fidel Castro's death, a look back at the difficult history between the United States and Cuba

Obama noted the long and acrimonious history. “For nearly six decades, the relationship between the United States and Cuba was marked by discord and profound political disagreements,” he said. “During my presidency, we have worked hard to put the past behind us, pursuing a future in which the relationship between our two countries is defined not by our differences but by the many things that we share as neighbors and friends — bonds of family, culture, commerce, and common humanity.”

House Speaker Paul D. Ryan (R-Wis.), however, said the focus should not be on Castro, but those who have suffered under the Castro regime.

“Now that Fidel Castro is dead, the cruelty and oppression of his regime should die with him,” Ryan said in a statement. “Sadly, much work remains to secure the freedom of the Cuban people, and the United States must be fully committed to that work. Today let us reflect on the memory and sacrifices of all those who have suffered under the Castros.”

Senate Majority Leader Mitch McConnell (R-Ky.) released a similar statement:

“While Fidel Castro is gone, sadly the oppression that was the hallmark of his era is not. It is my hope that the Cuban regime will use this opportunity to turn the page for the good of the Cuban people and for all those living in the Americas. Freedom and democracy are long overdue in Cuba.”

But across Latin America, leaders spoke mostly kind words. Some stirred with revolutionary passion; others employed more diplomatic language. All acknowledged the iconic role of Castro in the region’s history.

Mexican President Enrique Peña Nieto hailed Castro as “a friend of Mexico, a promoter of a bilateral relation based on respect, dialogue and solidarity.”

The president of Venezuela, Nicolás Maduro, said that 60 years after Castro and a small band of fighters set sail aboard a fishing yacht called Granma, from Mexico to Cuba, to launch the revolution, “Fidel has joined the immortals.”

Maduro — whose own revolution has imploded since the death of predecessor and Castro ally Hugo Chávez and the onset of hard economic times — said Castro’s death should inspire “all us revolutionaries to honor his legacy.”

“Hasta victoria siempre!” he typed, employing the popular slogan “ever onward, to victory!”

Ecuadoran President Rafael Correa tweeted: “A great man has left us. Viva Cuba! Viva Latin America!”

In Brazil, former leftist president Dilma Rousseff praised Castro’s legacy in a blog post.

“Dreamers and progressive militants, everyone who fights for social justice and for a less unequal world, we all woke up sad this Saturday,” she wrote. “Fidel was one of the most important contemporary politicians and a visionary who believed in the construction of a more fraternal and just society, without hunger nor exploration, and in a united and strong Latin America.”

Leaders from outside Latin America also paid homage.

Russian President Vladimir Putin sent a telegram to the Cuban president that read in part, “The name of this distinguished statesman is rightly considered the symbol of an era in modern world history.”

In the era of the Soviet Union, Moscow was considered Castro’s closest ally, and the feeling was mutual.

“Fidel Castro was a true and reliable friend of Russia,” Putin said on Saturday. “He made an enormous personal contribution into the making and development of the Russian-Cuban relationship, of a close strategic partnership in all areas.”

Canadian Prime Minister Justin Trudeau addressed Castro’s dueling legacies. “A legendary revolutionary and orator, Mr. Castro made significant improvements to the education and healthcare of his island nation,” Trudeau said in a statement. “While a controversial figure, both Mr. Castro’s supporters and detractors recognized his tremendous dedication and love for the Cuban people who had a deep and lasting affection for ‘el Comandante.’ ”

South African President Jacob Zuma thanked Castro for his support to overthrow the country’s apartheid regime. Indian Prime Minister Narendra Modi called Castro “one of the most iconic personalities of the 20th century” and a “great friend” of India.

Palestinian diplomats posted photographs of Castro with former Palestinian leader Yasser Arafat.

Spain’s Foreign Ministry called Castro “a figure of great historic importance . . . who marked a great turning point in the destiny of his country and had great influence across the region.”

Andrew Roth in Moscow, Anne-Marie O’Connor in Jerusalem and Dom Phillips in Rio de Janeiro contributed to this report.