RIO DE JANEIRO (AP) -- 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 are giving way to an uncertain but potentially brighter future.
The president spoke from a theater 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 labor unions and dissident political groups. 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.
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.
Obama, who met Saturday with Rousseff, repeated that he hoped to strengthen ties between the two countries. Brazil's large and vibrant economy stands out in the region.
The speech was originally planned as an outdoor event on the plaza open to all, but U.S. officials decided at the last-minute to move it inside the theater and make it invitation-only "due to a number of concerns," according to a Friday press release from the U.S. Embassy.
While the speech was billed as an address to the people of Brazil, his audience was relatively small - about 1,800 fit in the ornate theater - many elegantly dressed. Judging by the number who listened without translator headphones, many spoke English.
Obama, who earlier Sunday visited a notorious Rio slum called City of God where he played soccer with local kids, made a direct pitch to common bonds. He recalled how his mother's favorite movie was Black Orpheus, filmed in the shantytowns of Rio during Carnival. He cited the similar histories of the U.S. and Brazil, two countries that emerged from colonial pasts, grew through vast immigration and "eventually cleansed the stain of slavery from our land. "
The president cheered Brazil's remarkable economic growth, but gently prodded Brazilians saying that such expansion also brings responsibility. And he called on Brazil to join the United States in demanding universal rights around the globe.
"These are not American or Brazilian ideas," he said. "They are not Western ideas. They are universal rights, and we must support them everywhere."
The president's sightseeing and speech in Brazil on Sunday were sure to endear him even more to the diverse and multicultural country where his personal story already makes him popular. That advances the overall goals of the five-day Latin American trip - with Chile and El Salvador next on the itinerary - which aims to cast Obama and the United States as attentive neighbors from the North, eager to capitalize on the region's economic successes while addressing common security concerns.
From the start, however, Obama's attention has been divided. He's been forced to shuttle from events in Brazil to briefings with his national security team on Libya. On Sunday morning he conferred with Secretary of State Hillary Clinton, Defense Secretary Robert Gates and other top officials by secure phone before motorcading from his hotel across from the famed Copacabana beach to a helicopter, and finally by car into the City of God slum. It's one of more than 1,000 slums, or "favelas," that dot the urban hills surrounding the city but also one that has become part of an ambitious "pacification" program aimed at reducing violence in Rio.
Advisers said the favela tour was designed to illustrate Obama's push for what officials call "citizen security," an emerging concern in Latin American countries as they wrestle with narco-crime and lingering poverty. The president was met by cheering crowds hanging from rooftops and balconies as he visited a community center in the shantytown.
The president was to end his stay in Rio with a nighttime walking tour of Corcovado Mountain to the Christ the Redeemer Statue that is the very symbol of the city. Initially, Obama had planned to visit the Christ statue at mid-morning. Aides said the change in schedule and shifting the speech to an indoor venue were due to logistical adjustments. They said they feared the statue would be shrouded in fog Sunday - a mist did cover the hills around Rio.
But the changes had the effect of lowering Obama's profile in the city, reducing the opportunity for clashing images as international attention remained riveted in Libya.
Obama departs Brazil early Monday and heads for Chile. On Tuesday he goes to El Salvador.