Fidel Castro, who has died aged 90, became a revolutionary hero when he overthrew the corrupt and brutal dictatorship of Fulgencio Batista in Cuba in 1959.
During nearly five decades in power his triumph increasingly appeared as a disaster - for Cuba; for the world; even, ultimately, for himself.
Within three years of taking power, Castro had installed all the dreary apparatus of a Communist dictatorship. Opponents were executed and former allies imprisoned; priests, churchgoers and homosexuals were singled out for persecution. Dissidents were incarcerated and the press censored.
The problem, though, was that he had led a revolution with little but an ill-defined aspiration to improve the lot of the rural poor. With Castro, power was all; ideology nothing.
Notwithstanding the ecstatic welcome which Castro received when he visited the United States in 1959, the only other consistent driving force of his career was a visceral anti-Americanism. Shortly after that visit he began to harass the operations of American oil companies in Cuba. Washington retaliated with economic sanctions. Fearing an American invasion, Castro turned towards the Soviet Union.
This policy provoked the disastrously bungled Bay of Pigs invasion in April 1961. A band of some 1400 Cuban exiles attempted, with the help of American bombers, to wrest Cuba from the dictator's control.
The crisis showed Castro at his best. Anticipating the threat from the bombers, he dispersed his own planes and saved his meagre air force, which he then used to eliminate the invaders' ships as soon as they landed. Cut off, the invaders were soon surrounded and captured.
Castro announced for the first time that Cuba was a socialist state, and at the end of 1961 declared himself a "Marxist-Leninist". In May 1962 the Soviet Union began the secret installation of nuclear missiles in Cuba. Though Castro understood that Soviet Premier Nikita Khrushchev's aim was to achieve parity in the global balance of terror, he had no compunction about accepting the missiles. He rejoiced at the opportunity to humiliate, perhaps even to destroy, the arch-enemy.
The world survived, thanks to US President John F. Kennedy's firm handling of the crisis, and Khrushchev's willingness to step back from Armageddon. Castro was disgusted by the Russian climb-down.
In Cuba, the disastrous consequences of the revolutionary regime were becoming evident. Castro had inherited a comparatively prosperous economy, and he proceeded to enhance his popularity by increasing wages and halving rents. Within two years the country's reserves were exhausted and foreign investment had fled.
He made deals whereby the Soviet Union bought Cuban sugar and paid in arms and heavy manufactures. The Cuban population, however, was left with little more than the means of survival. In the countryside, it is true, the regime could claim notable advances. In 1959 some 200,000 peasants became possessors of their own land, even if they were told what to grow and what prices they should charge. Over the years better health care raised life expectancy. Improved schooling raised standards of literacy, and higher education eventually became universally available.
Had the welfare of the Cuban people been Castro's first priority, he would never have committed so much of the country's meagre wealth to interference in the Third World, where he dreamed of establishing himself as the chief apostle of global revolution. To this end he turned Cuba into the most militarised state in Latin America. By 1989 his army consisted of 145,000 regulars and 110,000 ready reserves - plus one million more in the Territorial Troop Militia, an astonishing figure for a country with a total population of only 10 million.
Cuban soldiers and agents were sent all over the world and played a vital role in several major conflicts.
Fidel Alejandro Castro Ruz was born on August 13, 1926 on his father's farm near the town of Mayari, in the Oriente province of Cuba. His father, Angel, had been born in Spain, but had come to Cuba as a cavalryman in the Spanish Army in 1905 and amassed huge wealth. His mother, Lina had arrived as a maid when Angel was already married. She gave birth to three children, including Fidel, out of wedlock.
Fidel became a boarder at the La Salle school in Santiago de Cuba, where he proved a turbulent pupil; as a result he was transferred first to Colegio Dolores, a school run by the Jesuits in Santiago, and then, in 1942, to Belen in Havana, the best Jesuit school in Cuba.
Fidel went on to read law at Havana University, where he became closely associated with the Union Insurrecional Revolucionaria, and attached himself to the Party of the Cuban People (Ortodoxos) under the leadership of Eduardo Chibas. In addition he was already fascinated by anti-imperialist movements beyond Cuba, travelling to Panama and Colombia in 1948.
The other notable event in Castro's life in 1948 was his marriage to Mirta Diaz Balart, the sister of a fellow law student. They spent their honeymoon in the United States.
After graduation in 1950 Castro worked for a while as a radical journalist, until the suicide of Chibas in 1952 opened up the possibility of leading the Ortodoxo Party. He decided to stand for the House of Representatives; the election, however, was cancelled, owing to the coup which brought Batista to power.
On July 26, 1953 he led a motley group of farm labourers, factory workers and shop assistants in a suicidal attack on the Moncada military barracks at Santiago de Cuba. They killed 19 soldiers and lost only three men themselves. Castro escaped, though he was arrested five days later. He was sentenced to 13 years' jail.
Confined in the Presidio Modelo on the Isle of Pines, he read voraciously, and produced a political testament in which he set out his rather hazy ideas for winning justice for "the vast unredeemed masses". In 1955 Batista decided to release the Moncada terrorists.
Castro immediately began attacking the government in the press, and then, as Batista's police closed in on him, fled to Mexico. There he met Che Guevara, with whom he plotted armed insurrection against Batista, visiting the United States to raise money. Then, having acquired a 16m motorboat designed to sleep eight people, he crammed 80 men on board, together with weapons and ammunition, and on November 25, 1957 set sail for Cuba.
A week later their landing in south-east Cuba was virtually a shipwreck; the men had to wade to the shore; heavy arms, food and a radio transmitter were lost. On December 5 they were attacked by government forces. Three of the invaders were killed; 39 were captured and either imprisoned or executed; 21 fled. Castro led the 20 men remaining under his command into the Sierra Maestra, where they endured terrible privations of cold and hunger. But his rebellion against the unpopular dictatorship began to gain support.
By the end of 1958, Batista had lost the support of the Americans, and on New Year's Day 1959 he fled Cuba. A week later Castro and his army marched triumphantly into Havana.
For 30 years the Cuban people were merely reduced to penury, but after the Soviet empire collapsed in 1989 they struggled to avoid starvation. Thousands attempted to reach the US on precarious home-made rafts, only to be sent back when caught. In this crisis Castro found himself compelled to allow Cubans to earn and spend more dollars, to open the country to tourism, to lift restrictions on religion. But he could not bring himself to admit that his anti-Americanism was now redundant.
Castro had been suffering from ill health for some time when, in February 2008, he announced that he would neither seek nor accept a new term as president. While he retained the office of First Secretary of the Communist Party, Cuba's National Assembly elected his brother, Raul, to succeed him as president. It was Raul who, working with US President Barack Obama, began the process of normalising relations.
By his first marriage to Mirta Diaz Balart (dissolved 1954), Fidel had a son. By his second, to Dalia Soto del Valle, he had five sons. He also had a daughter by Naty Revuelta.
Cuba under Fidel Castro
January 1, 1959 Castro's rebels take power as dictator Fulgencio Batista flees Cuba.
June 1960 Cuba nationalises US-owned oil refineries after they refuse to process Soviet oil. Nearly all other US businesses expropriated by October.
October 1960 Washington bans exports to Cuba, other than food and medicine.
April 16, 1961 Castro declares Cuba socialist state.
April 19, 2016 Castro delivers a valedictory speech at the Communist Party's seventh Congress, declaring that "soon I'll be like all the others. The time will come for all of us, but the ideas of the Cuban Communists will remain.".