HAVANA (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.