U.S. President Barack Obama speaks to the media after he "doused eleven flames" as he tours the Shwedagon Pagoda with Secretary of State Hillary Rodham Clinton in Yangon, Myanmar, Monday, Nov. 19, 2012. This is the first visit to Myanmar by a sitting U.S. president. (AP Photo/Carolyn Kaster)

YANGON (Reuters) - Barack Obama became the first serving U.S. president to visit Myanmar on Monday, trying during a whirlwind six-hour trip to strike a balance between praising the government's progress in shaking off military rule and pressing for more reform.

Obama, who was greeted by enthusiastic crowds in the former capital, Yangon, met President Thein Sein, a former junta member who has spearheaded reforms since taking office in March 2011, and opposition leader Aung San Suu Kyi.

"I've shared with him the fact that I recognize this is just the first steps on what will be a long journey," Obama, with Thein Sein at his side, told reporters after their talks.

"But we think a process of democratic and economic reform here in Myanmar that has been begun by the president is one that can lead to incredible development opportunities," he added, using the country name preferred by the government and former junta, rather than Burma, which is used in the United States.

Thein Sein, speaking in Burmese with an interpreter translating his remarks, responded that the two sides would move forward, "based on mutual trust, respect and understanding".

"During our discussions, we also reached agreement for the development of democracy in Myanmar and for promotion of human rights to be aligned with international standards," he added.

Obama's Southeast Asian trip, less than two weeks after his re-election, is aimed at showing how serious he is about shifting the U.S. strategic focus eastwards as America winds down wars in Iraq and Afghanistan. The so-called "Asia pivot" is also meant to counter China's rising influence.

The trip to Myanmar is also intended to highlight what the White House has touted as a major foreign policy achievement -- its success in pushing the country's generals to enact changes that have unfolded with surprising speed over the past year.

Tens of thousands of well-wishers, including children waving American and Burmese flags, had lined Obama's route from the airport, cheering him as he went by.

"ICON OF DEMOCRACY"

Obama met fellow Nobel Peace Prize laureate Suu Kyi, who led the struggle against military rule and is now a lawmaker, at the lakeside home where she spent years under house arrest.

Addressing reporters afterwards, Suu Kyi thanked Obama for supporting the political reform process. But, speaking so softly she was barely audible at times, she cautioned that the most difficult time was "when we think that success is in sight".

"Then we have to be very careful that we are not lured by a mirage of success and that we are working towards genuine success for our people," she said.

Obama recalled Suu Kyi's years of captivity and said she was "an icon of democracy who has inspired people not just in this country but around the world".

"Today marks the next step in a new chapter between the United States and Burma," he said. Before he left, the two embraced and he kissed her on the cheek.

Earlier, Obama made an unscheduled stop at the landmark Shwedagon Pagoda, where he, Secretary of State Hillary Clinton and their entire entourage, secret service agents included, went barefoot up the giant stone staircase.

STOP THE VIOLENCE

The United States has softened sanctions and removed a ban on most imports from Myanmar in response to reforms already undertaken, but it has set conditions for the full normalization of relations, including efforts to end ethnic conflict.

In recent months, sectarian violence between majority Buddhists and the Rohingya Muslim minority in the western state of Rakhine has killed at least 167 people.

Many in Myanmar consider the Rohingya Muslims to be illegal immigrants from neighboring Bangladesh and the government does not recognize them as citizens. A Reuters investigation into the wave of sectarian assaults painted a picture of organized attacks against the Muslim community.

"For too long, the people of this state, including ethnic Rakhine, have faced crushing poverty and persecution. But there's no excuse for violence against innocent people," Obama told a packed audience for a speech at Yangon University.

"The Rohingya ... hold within themselves the same dignity as you do, and I do. National reconciliation will take time, but for the sake of our common humanity, and for the sake of this country's future, it's necessary to stop incitement and to stop violence," he said.

Thein Sein, in a letter to U.N. Secretary-General Ban Ki-moon last week, promised to tackle the root causes of the problem, and Obama said he welcomed "the government's commitment to address the issues of injustice, and accountability, and humanitarian access and citizenship".

PRISONERS RELEASED

Some human rights groups had objected to the visit to Myanmar, saying Obama was rewarding the government of the former pariah state for a job that was incomplete. Speaking in Thailand on the eve of his visit, Obama denied he was going to offer his "endorsement" or that his trip was premature.

Aides said Obama was determined to "lock in" the democratic changes under way in Myanmar but would press for further action, including the freeing of all political prisoners.

A senior U.S. official said Obama would announce the resumption of U.S. aid programmes in Myanmar during his visit, anticipating assistance of $170 million in fiscal 2012 and 2013, but this, too, would be dependent on further reforms.

In a move clearly timed to show goodwill, the authorities began to release dozens more political detainees on Monday, including Myint Aye, arguably the most prominent dissident left in its gulag.

Despite human rights concerns, the White House sees Myanmar as a legacy-building success story of Obama's policy of seeking engagement with U.S. enemies. In his Yangon speech, he appealed to North Korea to take a similar path.

"To the leadership of North Korea, I've offered a choice: let go of your nuclear weapons, and choose the path of peace and progress. If you do, you'll find an extended hand from the United States of America," he said.