RIO DE JANEIRO, Brazil - As U.S. warplanes pounded faraway Libya, President Barack Obama praised Brazil's transition from dictatorship to democracy as a model for the Arab world where decades of stability enforced by strongmen is giving way to an uncertain but potentially brighter future.

The president spoke from a theatre in a historic Rio de Janeiro square where a 1984 protest set the stage for the eventual end of a 20-year military dictatorship.

He said those protesters showed how a popular revolt could produce a thriving democracy. And without specifically mentioning the military action he authorized just a day ago in Libya, the president drew a connection to the events there and throughout the Middle East.

"We've seen the people of Libya take a courageous stand against a regime determined to brutalize its own citizens. Across the region, we have seen young people rise up -- a new generation demanding the right to determine their own future," the president said.

"From the beginning, we have made clear that the change they seek must be driven by their own people. But as two nations who have struggled over many generations to perfect our own democracies, the United States and Brazil know that the future of the Arab world will be determined by its people."

The events in Libya had threatened to overshadow Obama's three-country, five-day Latin American tour, so Obama sought on Sunday to use Brazil's own history to illuminate what's happening halfway around the world.

The president, speaking on day two of his trip, underscored that the people of Brazil determined the country's future, as he said must happen in the Middle East. It's a message Obama has conveyed ever since Tunisia's uprising in January set off a chain reaction through Egypt and to Libya.

With the U.S. now involved in military action to enforce an internationally authorized no-fly zone over Libya Obama wants to be particularly clear to his audience back home that the U.S. will not write the final chapter in that country, or any other. He's insisted there will be no American ground troops in Libya.

"No one can say for certain how this change will end, but I do know that change is not something that we should fear," the president said.

"That is the example of Brazil. Brazil -- a country that shows that a dictatorship can become a thriving democracy. Brazil -- a country that shows democracy delivers both freedom and opportunity to its people. Brazil -- a country that shows how a call for change that starts in the streets can transform a city, a country, and the world."

Brazil was ruled by a military dictatorship from 1964-85, a regime that was eased from power not by a sharp, violent revolution, but through a long, massive popular movement of peaceful protest and strikes led in large part by labour unions and dissident political groups.

Brazil is now enjoying one of the strongest democratic moments in its political history, and analysts have lauded the quality of its leadership during the last 16 years under former Presidents Fernando Henrique Cardoso and Luiz Inacio Lula da Silva.

New President Dilma Rousseff, the nation's first female leader, who took power in January, was a key member of a Marxist militant group that battled against the dictatorship.

Obama, who met Saturday with Rousseff, repeated that he hoped to strengthen ties between the two countries. Brazil large and vibrant economy stands out in the region.