An ailing Fidel Castro resigned as Cuba's president Tuesday after nearly a half-century in power, saying he will not accept a new term when the new parliament meets Sunday. "I will not aspire to nor accept - I repeat, I will not aspire to nor accept - the post of President of the Council of State and Commander in Chief," read a letter signed by Castro published early Tuesday in the online edition of the Communist Party daily Granma. The announcement effectively ends the rule of the 81-year-old Castro after almost 50 years, positioning his 76-year-old brother Raul for permanent succession to the presidency. Fidel Castro temporarily ceded his powers to his brother on July 31, 2006, when he announced that he had undergone intestinal surgery. Since then, the elder Castro has not been seen in public, appearing only sporadically in official photographs and videotapes and publishing dense essays about mostly international themes as his younger brother has consolidated his rule. A new National Assembly was elected in January, and will meet for the first time Sunday to pick the governing Council of State, including the presidency that Fidel Castro has held for decades. There had been wide speculation about whether he would continue in that role. Castro rose to power on New Year's Day 1959 and reshaped Cuba into a communist state 90 miles (145 kilometers) from US shores. The fiery guerrilla leader survived assassination attempts, a CIA-backed invasion and a missile crisis that brought the world to the brink of nuclear war. Ten US administrations tried to topple him, most famously in the disastrous Bay of Pigs invasion of 1961. His ironclad rule ensured Cuba remained communist long after the breakup of the Soviet Union and the collapse of communism across Eastern Europe. Monarchs excepted, Castro was the world's longest ruling head of state. Raul Castro had long been his brother's designated successor. The longtime defense minister had been in his brother's rebel movements since 1953 and spent decades as No. 2 in Cuba's power structure. The United States, bent on ensuring neither brother is in power, built a detailed plan in 2005 for American assistance to ensure a democratic transition on the island of 11.2 million people after Fidel Castro's death. But Cuban officials insisted there would be no transition, saying the island's socialist political and economic systems would outlive Castro. Castro's supporters admired his ability to provide a high level of health care and education for citizens while remaining fully independent of the United States. His detractors called him a dictator whose totalitarian government systematically denied individual freedoms and civil liberties such as speech, movement and assembly. The United States was the first country to recognize Castro after his guerrilla movement drove out then-President Fulgencio Batista in 1959. But the two countries soon clashed over Castro's increasingly radical path. Castro seized American property and businesses and invited Soviet aid. On April 16, 1961, Castro declared his revolution to be socialist. A day later, he defeated the CIA-backed Bay of Pigs invasion. The United States squeezed Cuba's economy and the CIA plotted to kill Castro. Undaunted, the Cuban president supplied troops and support to revolutionaries in Africa and Latin America. Hostility over Cuba reached its peak on Oct. 22, 1962, when US President John F. Kennedy announced there were Soviet nuclear missiles in Cuba. After a tense week of diplomacy, Soviet Premier Nikita S. Krushchev pulled out the weapons. With the end of the Cold War in the early 1990s, Castro eventually made peace with many governments that once shunned him. Pope John Paul II visited the island in January 1998. The loss of Soviet aid plunged Cuba into financial crisis, but the economy slowly recovered in the late 1990s with a tourism boom. Castro later reasserted control over the economy, stifling the limited free enterprise tolerated during more difficult times. 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. He attended Roman Catholic schools and the University of Havana, where he received law and social science degrees. Castro launched his revolutionary battle as a young man, organizing an unsuccessful July 26, 1953 attack on a military barracks in the eastern city of Santiago. Later freed under a pardon, Castro went to Mexico and organized a rebel army that returned to Cuba and rallied support in the Sierra Maestra mountains. His rebels took power when Batista was forced to flee. Entering Havana triumphantly, Castro declared: "Power does not interest me, and I will not take it."