HAVANA, April 7 (Reuters) - Former Cuban President Fidel Castro, 89, made a rare appearance outside his home on Thursday, visiting a school to mark the birthday of a late revolutionary heroine days after penning a scornful critique of U.S. President Barack Obama's recent visit.
State television broadcast images of the gray-bearded Castro sitting at a desk and conversing with students and teachers at the school, named after Vilma Espin, who was his sister-in-law and died in 2007 at age 77.
"I'm sure that on a day like today, Vilma would be happy," said the leader of Cuba's 1959 revolution. Espin left a comfortable life to fight alongside Castro against the U.S.-backed government of Fulgencio Batista and later married his brother Raul, the current Cuban president.
"Everybody who dies fighting for the revolution leaves their energy on the way, they leave their effort and struggle," said a slightly hoarse Castro, dressed in a white sports jacket. His 90th birthday is in August.
Castro handed over power to his younger brother in 2008 after a serious illness. His appearance came a week after he penned a scathing editorial about Obama's recent historic visit to Cuba.
Castro did not meet Obama, although he often appears in photographs meeting foreign dignitaries at his home. State television last showed him in public visiting Defense Ministry workers in July.
Next week, the Cuban Communist Party that Castro founded and led until eight years ago is scheduled to hold a congress organized no more than every five years to define the country's economic path and shore up the political power of its leaders.
Cubans are eager to find out if the congress will give clues to who will lead the country's only political party after Raul Castro retires from the presidency, something he has said will happen in 2018.
See Fidel Castro's life in photos:
Fidel Castro's life in photos
Fidel Castro makes rare public appearance after Obama visit
The caption describing Fidel Castro in his 1945 high school yearbook reads: "Distinguished student and a fine athlete. Very popular. Will study law and we have no doubt he will have a brilliant future." (AP Photo)
Castro, the young anti-Batista Guerilla leader, center, is seen with his brother Raul Castro, left, and Camilo Cienfuegos, right, while operating in the mountains of eastern Cuba, March 14, 1957. (AP Photo/Andrew St. George)
Cuban rebel leader Fidel Castro and his son, Fidel Jr., are shown in their apartment in the Hilton Hotel in Havana, Cuba, February 6, 1959. (AP Photo)
Cuban Prime Minister Fidel Castro (seated above numbers 732) rides in public bus from presidential Palace to the University of Havana stadium for the second half of a two part address, March 16, 1959. Castro first addressed crowd in front of the palace, later continued his speech at the stadium. The occasion was the second anniversary of the March 13, 1957 invasion of the palace by university students in attempt to assassinate then President Fulgencio Batista. Twenty-seven students were killed during the attack on the palace. (AP Photo)
Fidel Castro, Prime Minister of Cuba, smiles as he walks into the Cuban Embassy in Washington, D.C., after an enthusiastic reception at the National Airport on April 15, 1959. The leader of the Cuban revolution is on an unofficial visit to the United States. (AP Photo)
Fidel Castro, Cuban Prime Minister, answers a question from a panel on the NBC television program, "Meet the Press," in Washington April 19, 1959. He said at one point that Cuba would be committed to the West in event of any struggle between Democracy and Communism. At left is Ned Brooks, the moderator. (AP Photo)
Cuban Premier Fidel Castro extends his hand as he addresses the United Nations General Assembly in New York, September 26, 1960. (AP Photo)
Cuban Prime Minister Fidel Castro replied to President Kennedy's naval blockade over Cuban radio and television, October 23, 1962. This picture of Castro during his speech was copied from a television monitor in Key West, Florida. To defuse the Cuban missile crisis, President Kennedy promised not to invade the island nation, but newly declassified documents show he later retreated from the pledge, fearing Cuba could become an `invulnerable base.'' The change of heart meant that the U.S.-Soviet understandings that resolved the 1962 crisis were never made permanent. (AP Photo)
Cuban Premier Fidel Castro gets ready to pitch to the first batter as he opens the 1965 National Baseball Championship at Havana's Latin-American Park, in Cuba, on January 31, 1965. (AP Photo)
Cuban Prime Minister Fidel Castro responds to a question from American NBC reporter Barbara Walters during a news conference granted to members of the U.S. press covering Senator George McGovern's trip to Cuba, in Havana, May 7, 1975. (AP Photo)
King Jigme Singye Wangchuk of Bhutan, left, and Cuban President Fidel Castro stand for the playing of the National Anthems of the two countries as the King arrived for the upcoming 6th Non-Aligned Meeting in Havana, Cuba, Saturday, Sept. 1, 1979. (AP Photo)
Cuban President Fidel Castro waves to a crowd in Montego Bay, Jamaica, after being introduced by Jamaican Prime Minister Michael Manley during a state visit by the Cuban leader Fidel Castro in September 1977. Manley led Jamaica to the forefront of the developing world's non-aligned movement in the 1970s. (AP Photo)
FILE -- This is a July 10, 1977 file photo of Cuban Prime Minister Fidel Castro taken in Havana, Cuba. The National Security Agency, in declassified documents released Tuesday August 19, 1997 reported that Castro feared the United States would use the Kennedy assassination as an excuse to oust his communist government. An ``emotional and uneasy'' Fidel Castro mobilized his armed forces and went on Cuban national television after President Kennedy's assassination out of fear the United States would blame him and invade in retaliation, government documents say. (AP Photo/File)
U.S. Presidential candidate Jesse Jackson, left, and Cuban President Fidel Castro shake hands as they say goodbye in Havana, Cuba, June 27, 1984. At center is Juanita Vera, Castro's personal interpreter. Jackson will return to Havana after his trip to Nicaragua to pick up the released American prisoners to take with him to Washington, D.C. Jackson and Castro met over two days seeking solutions to better U.S.-Cuba relations. (AP Photo/Scott Applewhite)
Cuban Prime Minister Fidel Castro exhales cigar smoke during a March, 1985 interview at his presidential palace in Havana. Castro, a Havana attorney who fought for the poor, overthrew dictator Fulgencio Batista's government on Jan. 1, 1959. He defeated a U.S. attempt, known as The Bay of Pigs invasion, to overthrow his revolutionary regime on April 19, 1961. Afterwards, Cuba armed itself with Soviet nuclear missiles aimed at the United States which almost brought the world to the brink of nuclear disaster. Castro's communist regime still exists in Cuba, 90 miles from the U.S., at the close of the 20th century. (AP Photo/ Charles Tasnadi)
Cuban President Fidel Castro, right, and African leader Nelson Mandela gesture during the celebration of the "Day of the Revolution" in Matanzas Saturday, July 27, 1991. Cubans celebrate 38th anniversary of the revolution. (AP Photo/Alejandro Balaguer)
Cuban President Fidel Castro holds on to his cap during a windy welcome Sunday, Oct. 15, 1995, upon his arrival at San Carlos de Bariloche, some 1,060 miles southwest of Buenos Aires, Argentina, where he, along with several other heads of state, is to attend the Ibero-American Summit which officially begins Monday. Education is the official summit subject. But Castro's presence is likely to prompt both condemnation of the U.S. trade embargo of the Caribbean island and calls for Castro to continue opening Cuba's socialist economy. (AP Photo/Jorge Saenz)
Cuban President Fidel Castro waves to thousands of supporters in the square facing the municipal palace where he received the keys to the city, Saturday, Oct. 14, 1995 in Montevideo, Uruguay. Castro said he was proud to have resisted U.S. efforts to topple his communist regime and vowed that Cuba would survive the American trade embargo. Castro is in Uruguay on a short visit before attending the 5th Ibero-American Summit in neighboring Argentina. (AP Photo/Carlos Gonzalez)
Cuban leader Fidel Castro talks with Pope John Paul II during their historic meeting at the Vatican Tuesday, November 19 1996. Castro invited the Pope to visit Cuba next year. The Pontiff accepted, but no date for the visit has been set. (AP Photo/Arturo Mari)
Cuba leader Fidel Castro speaking to journalists on his arrival in Geneva Wednesday, May 13 1998, to participate in the 50th anniversary of the WHO (World Health Organisation) on Thursday, May 14, and also the 50th anniversary of the WTO (World Trade Organisation) on Monday, May 18. (AP Photo/MARTIAL TREZZINI)
Newly named Cuban Foreign Minister Felipe Perez Roque, right, is shown with Fidel Castro during May Day celebrations in Havana, Cuba in this May 1, 1999 photo. Cuban Foreign Minister Roberto Robaina, has been replaced by Perez Roque Castro's 34-year-old chief of staff, the government announced Friday May 28, 1999. (AP Photo/Jose Goitia)
Cuban President Fidel Castro gestures Thursday Sept.14, 2000, at the Revolution Palace in Havana, Cuba as he welcomes Sheikh Hamad Bin Khalifa Al-Thani, Emir of Qatar. Following on from visit to New York for the U.N. Summit Castro continues with his program of intense diplomatic activity. (AP Photo/Jose Goitia)
Cuban leader Fidel Castro observes an aircraft arriving for South African President Thabo Mbeki, at the Varadero Airport , 74 miles east of Havana, Cuba, Thursday March 29, 2001. Mbeki leaves the island aftr a four-day visit to Cuba. (AP Photo/Jose Goitia)
Cuban leader Fidel Castro gestures as he delivers a speech about terrorism during the end of the year session of the Cuban National Assembly Thursday Dec. 20, 2001 in Havana, Cuba On the right: Cuban Army chief and Castro's brother Raul Castro. (AP Photo/Jose Goitia)
Cuban leader Fidel Castro and Venezuelan Hugo Chavez talk in Pampatar Bay near Caracas, Venezuela Tuesday Dec, 11, 2001 where they participate at a rally to dedicate a new economic project to help poor Venezuelan fishermen. Castro is in Venezuela to attend a Caribbean association summit. (AP Photo/Jose Goitia)
Former U.S. President Jimmy Carter, left, speaks as Cuban President Fidel Castro, center, and former first lady Rosalynn Carter listen during a visit to a center for genetic engineering and biotechnology in Havana, Cuba, Monday, May 13, 2002. Carter is the first U.S. head of office, in or out of office, to visit communist Cuba since the 1959 revolution that put Castro in power. (AP Photo/Gregory Bull)
Cuban President Fidel Castro is seen waving a Cuban flag during a rally in front of the U.S. Interests Section in Havana, Monday, Nov. 18, 2002. Castro led tens of thousands of people in a rally outside the American mission to protest the U.S. government's decision to free eight Cubans who left the island last week on a stolen crop-duster plane. (AP Photo/Jose Goitia)
Cuban President Fidel Castro shakes hands with Li Changchun, member of the Chinese Politburo Standing Committee, looks on prior to a meeting at the Cuban State Council in Havana Monday July 7, 2003. Cuba and China are holding meetings to strengthen political and commercial ties. (AP Photo/Rafael Perez, Pool)
Cuban President Fidel Castro delivers a speech during a meeting of the Latin American Council of Social Sciences, Thursday Oct.30, 2003 in Havana, Cuba. (AP Photo/Jose Goitia)
Cuban President Fidel Castro gestures during his 5-hour-speech at the ending meeting of the the anti Free Trade of the Americas (FTAA) summit in Havana, Cuba, Jan. 29, 2004. (AP photo/Jose Goitia)
Cuban President Fidel Castro is seen on a wheel chair as he welcomes Chinese President Hu Jintao Monday Nov. 22, 2004, in Havana, Cuba. (AP Photo/Jose Goitia)
Cuban President Fidel Castro puts his hand on the head of Elian Gonzalez Tuesday, Dec. 6, 2005, in the coastal city of Cardenas Cuba. Gonzalez. Gonzalez, wearing his school uniform, sat next to Castro at the political event recalling the island's successful campaign to gain custody of the boy from the United States. The Cuban boy thrust into the center of an international custody battle six years ago, celebrated his 12th birthday Tuesday listening to a two-hour speech by Castro. (AP Photo/Jorge Rey)
Bolivian President-elect Evo Morales listens as Cuban President Fidel Castro, wearing a miner's helmet given to him by visiting miners, speaks to Bolivian students in Havana, Cuba, Friday, Dec. 30, 2005. Morales and an ebullient Fidel Castro gathered late Friday with scores of young Bolivians studying in Cuba as the Indian nationalist began reaching out to other government leaders even before he takes office. (AP Photo/Javier Galeano)
Cuban President Fidel Castro shakes hands with Sergei Sidorsky, Prime Minister of Belarus, at the Revolution Palace in Havana,Cuba, Friday, April 21, 2006. Sidorsky was launching an official visit to Cuba to discuss trade and cooperation programs with Castro. (AP Photo/Javier Galeano, Pool)
Cuba's leader Fidel Castro gestures before delivering a speech during the 50th anniversary of the Committee for the Defense of the Revolution, CDR, in Havana, Cuba, Tuesday, Sept. 28, 2010. (AP Photo/Javier Galeano)
Fidel Castro makes a surprise appearance at the 6th Communist Party Congress in Havana, Cuba, Tuesday April 19, 2011. Raul Castro was named first secretary of Cuba's Communist Party on Tuesday, with his brother Fidel not included in the leadership for the first time since the party's creation 46 years ago. (AP Photo/Javier Galeano)
In this photo released by the state media website Cubadebate, Cuba's leader Fidel Castro speaks during a meeting with intellectuals and writers at the International Book Fair in Havana, Cuba, Friday, Feb. 10 2012. (AP Photo/Cubadebate, Roberto Chile)
Cuba's leader Fidel Castro talks to reporters at a polling station after casting his ballot in parliament elections in Havana, Cuba, Sunday, Feb. 3, 2013. More than 8 million islanders are eligible to vote and will approve 612 members of the National Assembly and over 1,600 provincial delegates. (AP Photo/Ismael Francisco, Cubadebate)
Cuba's Fidel Castro, center, meets with Russia's President Vladimir Putin, right, in Havana, Cuba, Friday, July 11, 2014. Putin began a Latin American tour aimed at boosting trade and ties in the region with a stop Friday in Cuba, a key Soviet ally during the Cold War that has backed Moscow in its dispute with the West over Ukraine. (AP Photo/Alex Castro)
Pope Francis (L) and former Cuban President Fidel Castro hold hands in Havana, Cuba, September 20, 2015. Picture taken September 20. REUTERS/Alex Castro/AIN/Handout via Reuters ATTENTION EDITORS - THIS IMAGE WAS PROVIDED BY A THIRD PARTY. REUTERS IS UNABLE TO INDEPENDENTLY VERIFY THE AUTHENTICITY, CONTENT, LOCATION OR DATE OF THIS IMAGE. IT IS DISTRIBUTED EXACTLY AS RECEIVED BY REUTERS, AS A SERVICE TO CLIENTS. FOR EDITORIAL USE ONLY. NOT FOR SALE FOR MARKETING OR ADVERTISING CAMPAIGNS.
Former Cuban president Fidel Castro and Russian Orthodox Patriarch Kirill meet in Havana February 13, 2016. REUTERS/JUVENTUD REBELDE/Handout via Reuters ATTENTION EDITORS - THIS PICTURE WAS PROVIDED BY A THIRD PARTY. REUTERS IS UNABLE TO INDEPENDENTLY VERIFY THE AUTHENTICITY, CONTENT, LOCATION OR DATE OF THIS IMAGE. THIS PICTURE IS DISTRIBUTED EXACTLY AS RECEIVED BY REUTERS, AS A SERVICE TO CLIENTS. FOR EDITORIAL USE ONLY. NOT FOR SALE FOR MARKETING OR ADVERTISING CAMPAIGNS.NO RESALES. NO ARCHIVE TPX IMAGES OF THE DAY