Cuba's former president Fidel Castro, one of the world's longest-serving and most iconic leaders, has died aged 90.
His younger brother and successor as president Raul Castro announced the news on state television.
Castro toppled the government in 1959, introducing a Communist revolution. He defied the US for decades, surviving many assassination plots.
His supporters said he had given Cuba back to the people. Critics saw him as a dictator.
Ashen and grave, President Castro told the nation in an unexpected late night broadcast on state television that Fidel Castro had died and would be cremated later on Saturday.
"The commander in chief of the Cuban revolution died at 22:29 hours this evening (03:29 GMT Saturday)," he said. "Towards victory, always!" he added, using a revolutionary slogan.
A period of official mourning has been declared on the island until 4 December, when his ashes will be laid to rest in the south-eastern city of Santiago.
Barring the occasional newspaper column, Fidel Castro had essentially been retired from political life for several years.
In April, Fidel Castro gave a rare speech on the final day of the country's Communist Party congress.
"I'll soon be 90," the former president said, adding that this was "something I'd never imagined".
"Soon I'll be like all the others," Fidel Castro said, suggesting his "turn" to pass away was coming.
Castro was the longest serving non-royal leader of the 20th Century.
He temporarily handed over power to his brother in 2006 as he was recovering from an acute intestinal ailment. Raul Castro officially became president two years later.
News of his death left some in Havana stunned.
"I always said it couldn't be," said one woman, a government employee. "Even though they said it now, I say it can't be."
How he defied the US
Throughout the Cold War, Fidel Castro was a thorn in Washington's side.
An accomplished tactician on the battlefield, he and his small army of guerrillas overthrew the military leader Fulgencio Batista in 1959 to widespread popular support.
Within two years of taking power, he declared the revolution to be Marxist-Leninist in nature and allied the island nation firmly to the Soviet Union.
Despite the constant threat of a US invasion as well as the long-standing economic embargo on the island, Castro managed to maintain a communist revolution in a nation just 90 miles (145km) off the coast of Florida.
Despised by his critics as much as he was revered by his followers, he maintained his rule through 10 US presidents and survived scores of attempts on his life by the CIA.
He established a one-party state, with hundreds of supporters of the Batista government executed. Political opponents have been imprisoned, the independent media suppressed. Thousands of Cubans have fled into exile.
How has the world reacted?
Latin American leaders have been quick to pay tribute.
Mexican President Enrique Pena Nieto said Castro was a "great friend" of Mexico, while to El Salvador's President Salvador Sanchez Ceren he was an "eternal companion".
Venezuela's President Nicolas Maduro said "revolutionaries of the world must follow his legacy".
The Soviet Union's last leader, Mikhail Gorbachev, said: "Fidel stood up and strengthened his country during the harshest American blockade, when there was colossal pressure on him."
Russian President Vladimir Putin described him as a "reliable and sincere friend" of Russia, while Chinese President Xi Jinping said "Comrade Castro will live forever".
For French President Francois Hollande, Castro embodied Cuba's revolution in both its "hopes" and its later "disappointments".
Pope Francis, who met Castro, an atheist, when he visited Cuba in 2015, called his death "sad news" and sent "sentiments of grief".
From US President-elect Donald Trump, who has threatened to reverse his predecessor's work to build ties with Cuba, came a brief tweet exclaiming the news:
In Miami, where there is a large Cuban community, there have been celebrations in some parts of the city, with people banging pots and cheering.
A Cuban exile group, the Cuban Democratic Directorate, said Castro left "legacy of intolerance" and had set up a "vicious totalitarian regime".
What happens next? Will Grant, BBC News, Cuba
Although the announcement of Fidel Castro's death caught many Cubans unawares, it can't be said that they weren't partly expecting it. In a sense, they have been preparing for this moment, a post-Fidel Cuba, for several years now as he retired from public life and largely disappeared from view.
But now that it has actually arrived, some are asking whether it will make any political different to Cuba's trajectory.
It's unlikely to, mainly because Raul Castro has already been implementing economic changes intended to attract foreign direct investment and ease the tight restrictions on ordinary Cubans. Plus, of course, there is the new rapprochement with Washington.
While it's still not clear what a Trump presidency will mean in that regard, those changes are unlikely to be reversed because of Castro's death. Nor will Cuba change its one-party political system in his absence.
Politically, his legacy lives on.
Fidel Castro's key dates
- 1926: Born in the south-eastern Oriente Province of Cuba
- 1953: Imprisoned after leading an unsuccessful rising against Batista's regime
- 1955: Released from prison under an amnesty deal
- 1956: With Che Guevara, begins a guerrilla war against the government
- 1959: Defeats Batista, sworn in as prime minister of Cuba
- 1961: Fights off CIA-sponsored Bay of Pigs invasion by Cuban exiles
- 1962: Sparks Cuban missile crisis by agreeing that USSR can deploy nuclear missiles in Cuba
- 1976: Elected president by Cuba's National Assembly
- 1992: Reaches an agreement with US over Cuban refugees
- 2006: Hands over reins to brother Raul due to health issues, stands down as president two years later