By Jeff Mason

ATHENS (Reuters) - President Barack Obama extolled the strengths of democracy from its Greek birthplace on Wednesday in a valedictory speech aimed at highlighting the values he sought to respect in office and prodding his Republican successor, Donald Trump, to follow suit.

On a farewell trip to Europe, Obama tried to reassure allies that core U.S. priorities, including a commitment to the NATO military alliance, would continue under Trump, despite the New York businessman's campaign trail statements that called that commitment into question.

Obama portrayed the United States as an example of democracies prizing the peaceful transfer of power, even when ideas between the incoming and outgoing leaders are opposed.

"The next American president and I could not be more different," he said to an audience in Athens. "We have very different points of view, but American democracy is bigger than any one person."

Obama took care of some local business in his speech. He urged creditors to help Greece dig out of its mountain of debt and called on young people to stay in the country to spur its economic recovery.

But his broader message extended beyond Athens.

Step-by-step, Obama listed the values of U.S. democracy that he and fellow Democrats in the United States have accused Trump of violating during his presidential campaign, an implicit call on his successor to change course.

In the same way that democracies are based on the peaceful resolution of disagreements within society, so cooperation is the best way to resolve conflicts with nations, he said.

"That's how with diplomacy we were able to shut down Iran's nuclear weapons program without firing a shot (and) with diplomacy the United States opened relations with Cuba," Obama said, referring to two important milestones of his presidency.

He noted how U.S. democracy had evolved to provide rights to women, African Americans, people with disabilities, and the gay community.

Trump has been criticized for his attitudes toward women and for making fun of a disabled reporter. He has pledged to ban Muslims temporarily from entering the United States and to deport undocumented immigrants who are living in the country illegally.

Democracy is why the United States welcomes "people of all races, and all religions and all backgrounds and immigrants who strive to give their children a better life," Obama said.

"Our democracies show that we are stronger than terrorists, fundamentalists and absolutists, who can't tolerate difference.

"Democracy is stronger than organizations like ISIS," he said, using one of the names for Islamic State.

"Because our democracies are inclusive, we are able to welcome people, and refugees in need, to our countries. And nowhere have we seen that compassion more evident than here in Greece," he said, referring to the Greek response to Europe's migrant crisis.

Obama highlighted the importance of a free press to expose injustice. Trump banned certain news outlets from his campaign events for writing stories he did not like. The Obama administration has been criticized for its record on press freedom as well, particularly for prosecuting government sources who leak information to journalists.

In his speech, Obama highlighted the importance of an independent judiciary to uphold the rule of law. During his campaign, Trump accused a U.S. judge of not being able to be impartial because of his Mexican heritage.

Obama also noted that elections hold leaders accountable.

"Any action by a president or any result of an election or any legislation that is proven flawed can be corrected through the process of democracy," he said.

(Additional reporting by Renee Maltezou and Karolina Tagaris and Michele Kambas in Athens Editing by Jeremy Gaunt)