Former Cuban president Fidel Castro has died at the age of 90 after a long battle with illness.

Annoucing the news on state television, his brother Raul Castro said: "Dear people of Cuba, with deep sadness I inform our people, the friends of our America and the world, that today... the commander in chief of the Cuban Revolution, Fidel Castro Ruz, has died.

"According to the will of comrade Fidel, his remains will be cremated."

Raul Castro, 85, added that officials organising his brother's funeral "will give our people detailed information about the organisation of the post-mortem homage".

He concluded: "Until the everlasting victory, always."

Fidel Castro took power following a revolution in 1959 and fended off a US-backed invasion at the Bay of Pigs two years later.

His alliance with Moscow helped trigger the Cuban Missile Crisis in 1962, a 13-day showdown with the United States that brought the world close to a nuclear war.

Castro ruled Cuba for 49 years, before standing down from office in February 2008 after a long illness.

Two years earlier he handed over power temporarily to his brother, after an acute infection in his colon forced him to undergo emergency surgery.

"I don't think Fidel's passing is the big test. The big test is handing the revolution over to the next generation and that will happen when Raul steps down," Cuba expert Phil Peters of the Lexington Institute in Virginia said before Castro's death.

After Queen Elizabeth II and the King of Thailand, the Cuban leader was the world's third longest-serving head of state.

Early life

Fidel Castro Ruz was born Aug. 13, 1926, in eastern Cuba's sugar country, where his Spanish immigrant father worked first recruiting labor for US sugar companies and later built up a prosperous plantation of his own.

Castro attended Jesuit schools, then the University of Havana, where he received law and social science degrees. His life as a rebel began in 1953 with an attack on the Moncada military barracks in the eastern city of Santiago. Most of his comrades were killed and Fidel and his brother Raul went to prison.

Fidel turned his trial defense into a manifesto that he smuggled out of jail, famously declaring, "History will absolve me."

Freed under a pardon, Castro fled to Mexico and organised a rebel band that returned in 1956, sailing across the Gulf of Mexico to Cuba on a yacht named Granma. After losing most of his group in a bungled landing, he rallied support in Cuba's eastern Sierra Maestra mountains.

Three years later, tens of thousands spilled into the streets of Havana to celebrate Batista's downfall and catch a glimpse of Castro as his rebel caravan arrived in the capital on Jan. 8, 1959. Castro was sworn in as prime minister of Cuba the following month.

Cold War

During the Cold War, he revealed his belief in socialism and declared his allegiance to the USSR early on in his rule.

In 1960, at the beginning of what would become a decades-long enmity between the two neighbors, Castro expropriated American-owned property and nationalised U.S.-owned assets and companies in Cuba. The US retaliated, first by initiating an economic embargo that would cripple Cuba’s economy and then by plotting his overthrow with the 1961 Bay of Pigs invasion, a CIA-orchestrated attack on Cuba that proved disastrous for the Americans.

A year after the invasion, Castro became a central figure in the most harrowing close call of the Cold War: the Cuban Missile Crisis.

Castro had consented to let the Soviets deploy ballistic missiles to Cuba, reportedly telling then-Soviet leader Nikita Khrushchev in a letter that a nuclear strike should be launched against the United States.

The missiles were spotted by an American spy plane in October 1962, and the destruction Castro spoke of was almost realised. Over the next two weeks, the Soviets and the Americans engaged in tense negotiations. However, the USSR ― to Castro’s fury ― finally agreed to remove the missiles from Cuba, and the crisis was averted.

He married Mirta Diaz-Balart in 1948, with whom he had a son, Fidel Felix Castro Diaz-Balart, born in 1949. They divorced in 1955. Although Castro never confirmed remarrying, he reportedly wed former schoolteacher Dalia Soto del Valle and had five sons.

Divisive

Castro remains a divisive figure, even in death. Reaction to the news has been mixed.

Cuban friends telling me parents are crying of relief, one is going to buy champagne now. One's parents saved a bottle to drink when he died