The death of Cuban leader Fidel Castro prompted expressions of respect in other parts of the world and measured responses from governments that saw the devoted socialist as a threat.

U.S. President Barack Obama noted that while “discord and profound political disagreements” marked the relationship between the United States and Cuba for nearly six decades, Americans were extending “a hand of friendship to the Cuban people” during their time of grief.

“History will record and judge the enormous impact of this singular figure on the people and world around him,” Obama said.

While spending the Thanksgiving weekend in Florida, where the announcement of Castro's death early Saturday brought Cuban exiles into the streets to celebrate, U.S. President-elect Donald Trump took to Twitter to share a thought that proved pithy even for the medium: “Fidel Castro is dead!”

Trump elaborated on his initial tweet later Saturday, calling Castro “a brutal dictator who oppressed his own people for nearly six decades.”

Trump says Castro left a legacy of “firing squads, theft, unimaginable suffering, poverty and the denial of fundamental human rights.”

Elsewhere in world, Castro was honoured and mourned by many present and former national leaders.

Canadian Prime Minister Justin Trudeau, whose father Pierre Elliot Trudeau was a close friend of the Cuban leader, called Castro a “legendary revolutionary and orator,” but also acknowledged that Castro was a controversial figure.

In a telegram to Cuban President Raul Castro, Fidel's 85-year-old brother, Pope Francis offered “my sense of grief to your excellency and family.”

Francis broke from the Vatican's usual practice of having the secretary of state send official condolences. In a mark of the esteem the pope held for Castro, whom he met during a visit to Cuba last year, Francis signed the telegram himself.

Russian President Vladimir Putin, whose country was Cuba's main ally and supporter during the Soviet era, called Castro “a sincere and reliable friend of Russia” who had built “an inspiring example for many countries and nations.”

Chinese President Xi Jinping said Castro “made immortal historical contributions to the development of socialism around the world.”

“With his death, the Chinese people have lost a close comrade and a sincere friend,” Xi said in a telegram to Raul Castro, state broadcaster CCTV reported. “His glorious image and great achievements will be recorded in history forever.”

United Nations Secretary General Ban Ki-moon said he had vivid memories of meeting Castro in January 2014 and having “a lively discussion that covered developments around the world as well as sustainable development and climate change.”

“Under former President Castro, Cuba made advances in the fields of education, literacy and health,” Ban said. “I hope Cuba will continue to advance on a path of reform and greater prosperity.

Salvador Sanchez Ceren, the president of El Salvador, said he felt “deep sorrow ... of my friend and eternal companion, Commander Fidel Castro Ruz.”

Mexican president Enrique Pena Nieto tweeted that “Fidel Castro was a friend of Mexico, promoting bilateral relations based on respect, dialogue and solidarity.”

Venezuelan President Nicolas Maduro recalled Castro's departure from Mexico on the yacht Granma with his brother Raul and several dozen supporters to start their revolution.

“Sixty years after the Granma sailed from Mexico, Fidel sails toward the immortality of all those who fight their whole lives,” Maduro tweeted. “Onward to victory, always!”

A statement from the Spanish government hailed Castro as “a figure of enormous historical importance.”

Loading... Loading... Loading... Loading... Loading... Loading...

“As a son of Spaniards, former president Castro always maintained close relations with Spain and showed great affection for his family and cultural ties,” the government statement said.

However, there were shouts and insults in Madrid as a small crowd composed of both pro- and anti-Castro supporters met in front of the Cuban embassy.

Turkey's foreign ministry commended the “legendary leader of the Cuban Revolution” for “instituting many deep reforms in his country from health care to education, art to science.”

“The struggle to which he dedicated his life echoed not just in Cuba but across the world, and has awakened respect even in other political camps,” the ministry said. “His words 'another world is possible' reflect the shared longing of billions of people from Latin America to Asia, from the Middle East to Africa.”

“India mourns the loss of a great friend,” Indian Prime Minister Nerendra Modi said on Twitter.

Greek Prime Minister Alexis Tsipras tweeted: “Goodbye, commandante. Until the peoples' eternal victory.”

“Fidel Castro in the 20th century did everything possible to destroy the colonial system, to establish co-operative relations,” former Soviet President Mikhail Gorbachev was quoted as telling the Interfax news agency.

Ammar al-Moussawi, who is in charge of international relations for Lebanon's militant Hezbollah group, lauded Castro as “a historic symbol whose life was a lighthouse to all revolutionaries around the world.”

Guyanese Prime Minister Moses Nagamootoo said Castro shared his island's resources with any nation that dared ask for help.

The Castro government sent thousands of doctors and nurses to work in remote Caribbean areas where local and other foreign medical personnel had refused to go, Nagamootoo said.

“His and Cuba's contribution to humanity and the Caribbean is unmatched by any other nation in terms of brotherly and sisterly relations. He was an international gift to humanity,” he said.

Former U.S. president Jimmy Carter said he and his wife Rosalynn “remember fondly our visits with him in Cuba and his love of his country.” The couple visited Cuba in 2002, long after Carter left office.

While most of the official remembrances were complimentary, a few emphasized less-flattering views of the late leader.

Ed Royce, chairman of the U.S. House of Representatives Foreign Affairs Committee, said, “No one should rule anywhere near as long as Fidel Castro did.”

“His legacy is one of repression at home, and support for terrorism abroad. Sadly, Raul Castro is no better for Cubans who yearn for freedom,” Royce said.

“I hope his death can start a freedom revolution in Cuba,” Denmark's Foreign Minister Kristian Jensen said. “Any demise is sad. In this case I believe that it can bring something good.”

Peter Hain, a former member of the British Cabinet and anti-apartheid campaigner, tempered praise for Castro with criticism of some aspects of his long rule.

“Although responsible for indefensible human rights and free-speech abuses, Castro created a society of unparalleled access to free health, education and equal opportunity despite an economically throttling USA siege,” Hain said. “His troops inflicted the first defeat on South Africa's troops in Angola in 1988, a vital turning point in the struggle against apartheid.”

Meanwhile, in Miami, Cuban exiles celebrated.

Within half an hour of the Cuban government’s announcement of the death of the 90-year-old revolutionary leader, cheers were heard in Miami’s Little Havana. Thousands of people banged pots, waved Cuban flags and whooped in jubilation. “Cuba si! Castro no!” they chanted, while others screamed “Cuba libre!”