Fidel Castro donned an olive-green shirt Saturday and traveled to Artemisa, a town west of Havana, to participate in an event honoring fallen fighters in his revolution.
This is the first time state media have reported Castro leaving Havana since he underwent emergency intestinal surgery in July 2006 and gave up power.
A picture from Saturday's ceremony at Artemisa is posted on a state media website showing Castro in green, although his shirt does not have the stars and insignia of the military uniform he wore for nearly a half century as Cuba's president.
State media said he was paying homage to the so-called martyrs of July 26, 1953, at an Artemisa mausoleum.
Castro was quoted as recalling the fiery spirit of young people from Artemisa and said "they were among the most militant in Cuba."
In a report on state-run television, it could be seen Castro wore athletic pants, his preferred clothing since falling ill in July 2006.
The 1953 attack on the Moncada barracks in the eastern city of Santiago de Cuba was led by Castro but went badly.
Many of the young people were killed, but the fight is viewed as the start of the Cuban revolution that put Castro in power in 1959.
The country will mark the 57th anniversary of the assault Monday with a speech by Castro's younger brother, President Raul Castro, in Santa Clara.
Except for occasional photographs and videos, Fidel Castro was out of sight for four years after undergoing intestinal surgery. He has re-emerged in recent public appearances around Havana, with one apparent aim being to broadcast his message of doom.
Castro has been warning for weeks in his writings that nuclear war is imminent, sparked by the United States in alliance with Israel, attempting to enforce international sanctions against Iran for its nuclear activities.
He also said the United States, his foe for more than five decades, will attack North Korea, causing the war to spread.
He repeated his warnings indirectly Saturday, saying news reports are confirming "the seriousness of the dangers that hover over humanity."
But, he said, "nobody can deprive us of the right to dream that it is still possible that our species can survive the difficult tests that await in the very near future."
Fidel Castro ceded power provisionally to his brother at the time of surgery, then officially when he resigned in February 2008 and Raul Castro was elected his successor by the National Assembly.
The Associated Press, Reuters and NBC News contributed to this report.