Updated

Fidel Castro defied America for nearly half a century, resisting U.S. attempts to topple him while wielding almost absolute control over the communist state he built just 90 miles (145 kilometers) south of Florida. He resigned as president Tuesday, two years after falling ill and temporarily ceding power.

Through 10 U.S. administrations beginning with that of Dwight Eisenhower, Castro survived assassination attempts, an invasion by a CIA-trained exile army at the Bay of Pigs, and a standoff with Washington over Soviet missiles that pushed the world to the brink of nuclear war.

"Socialism or death" was Castro's rallying cry long after his beard turned gray, the Soviet Union broke up and communism toppled across eastern Europe.

His defiance of the world's only remaining superpower excited many around the world, especially in Latin America, where Venezuela's President Hugo Chavez took up the torch of Castro's crusade against U.S. power.

Over the decades, Castro became such a constant presence in Cuban life, and ruled for so long and with such vigor, that many on the island assumed he would outlive them.

So this nation of 11 million was stunned on July 31, 2006, when Castro announced he had undergone intestinal surgery and was temporarily stepping aside. He appointed his brother Defense Minister Raul Castro, five years younger, to lead Cuba and its ruling Communist Party during his recovery.

Almost 19 months later, he announced Tuesday that he was stepping aside for good, and would not accept a nomination to serve another five-year term as president of the governing Council of State when the new parliament meets Sunday.

Castro's exact ailment and condition remain state secrets. Since falling ill, he has stayed out of public view, appearing only occasionally in photographs and videos released by the government to knock down rumors he was dead or dying.

In March 2007, Castro began penning a series of sporadic essays called "Reflections of the Commander in Chief," weighing in on a range of international issues. Castro said in his resignation letter that he would continue to write the essays under the new title, "Reflections of Comrade Fidel."

Castro came to power in the Cuban revolution on Jan. 1, 1959, when his revolution drove then-President Fulgencio Batista to flee. Monarchs excepted, he was the world's longest ruling head of state.

The United States was the first country to recognize Castro, but his radical economic reforms and rapid trials of Batista supporters — which often ended before firing squads — quickly unsettled U.S. leaders.

Washington eventually slapped a trade embargo on the island and severed diplomatic ties. Castro seized American property and businesses and turned to the Soviet Union for military and economic assistance.

On April 16, 1961, Castro declared his revolution to be socialist. The following day, he humiliated the United States by capturing more than 1,100 exile soldiers in the Bay of Pigs invasion.

The world neared nuclear conflict on Oct. 22, 1962, when U.S. President John F. Kennedy announced there were Soviet nuclear missiles in Cuba. After a tense week of diplomacy, Soviet leader Nikita Krushchev removed them.

Meanwhile, Cuban revolutionaries opened 10,000 new schools, erased illiteracy, and built a universal health care system. Castro backed revolutionary movements in Latin America and Africa.

But former liberties were whittled away as labor unions lost the right to strike, independent newspapers were shut down and religious institutions were harassed.

Over nearly five decades, hundreds of thousands of Cubans fled Castro's rule, many of them settling just across the Florida Straits in Miami.

When social pressures increased, Castro used migration as a safety valve. In 1980, he let 125,000 people flee to Florida by boat through Mariel port, west of Havana. When economic crisis sparked rioting in Havana in 1994, Castro opened Cuba's borders again, and an estimated 30,000 people took to the sea in rafts.

With Cuba's economy in a tailspin after the loss of Soviet aid, Castro was forced to open up to foreign capitalists and allow limited private enterprise.

But when the economy began recovering in the late 1990s, Castro reasserted control and stifled private business.

Castro continually resisted U.S. demands for multiparty elections and an open economy despite American laws tightening the embargo in 1992 and 1996.

He characterized a U.S. plan for American aid in a post-Castro era as a thinly disguised attempt at regime change and insisted his socialist system would survive long after his death.

Fidel Castro Ruz was born in eastern Cuba, where his Spanish immigrant father ran a prosperous plantation. His official birthday is Aug. 13, 1926, although some say he was born a year later.

Most details of Castro's family life were private.

The only child he publicly recognized was his first son, Fidel Jr., who he had with his first wife, Mirta Diaz Balart. Fidel Jr. went on to become a nuclear engineer and remained in Cuba.

Castro also had a daughter out of wedlock, Alina Fernandez Revuelta, who fled to the United States in 1993 and bitterly criticized her father in a book and in media interviews. CNN hired her as an analyst to comment on Cuban affairs after Castro fell ill in July 2006.

Former Castro confidantes in exile say Castro formed a family with a woman named Dalia Soto del Valle and that they had five sons together: Angel, Antonio, Alex, Alejandro and Alexis. It was unknown if the couple were legally married.

Castro was also said to have several other children from other relationships.

Talk of Castro's mortality was long taboo on the island, but that changed on June 23, 2001, when he fainted during a speech in the sun. Although Castro quickly returned to the stage, many Cubans understood for the first time that their leader would one day die.

Castro shattered a kneecap and broke an arm when he fell after a speech on Oct. 20, 2004, but typically laughed off rumors about his health, including a 2005 report that he had Parkinson's disease.

But the sustained intestinal bleeding that forced Castro to undergo surgery in late July 2006 was clearly life-threatening, something reflected in Castro's own sober description of his condition at the time.

"To affirm that the recovery period will take a short time and that there is no risk would be absolutely incorrect," he told Cubans on his 80th birthday, Aug. 13, 2006. "I ask you all to be optimistic, while at the same time ready to face any adverse news."