After years of dealing with failing health, Fidel Castro, leader of the Cuban revolution who steered the country through decades of a US economic blockade, has died, state media report.

Castro died in Havana on Friday at 10:29pm local time, Cuban television said. His death was announced by his brother Raul, who took the reins after Fidel stepped down.

Castro led the country from 1959 to 2006, when an intestinal condition nearly led to his death. He ceded power to his brother first provisionally, and then formally in 2008. In his last years, he mostly stayed out of the public eye, only occasionally providing commentary on events in Cuba.

His passing marks the end of an era for many. Castro was the last remaining leader from the group of old school communist leaders including Chinese Mao Zedong, Korean Kim Il-sung and Soviets Nikita Khrushchev and Leonid Brezhnev.

Dictator or national hero, Castro was called many things along the way, as he rose from being a student activist protesting against oppressive regimes to becoming the president of Cuba.

In February 1959, the Cuban Revolution brought Castro to power as the prime minister. He was backed by the so-called 26th of July Movement, and Latin American revolutionary Che Guevara. Together, they managed to oust US-backed President Batista.