(CNN) -- In the summer of 1943, when Adolf Hitler's armies marched unchecked across Europe, a pastor in a remote New England village decided to write a prayer.
"God grant me the serenity to accept the things I cannot change," he began, "the courage to change the things I can and the wisdom to know the difference."
It is now known as the Serenity Prayer. It's been adopted by 12-step recovery programs and cited in numerous self-help books. Yet few people know who wrote it. His name is Reinhold Niebuhr, and he was a Protestant pastor in the mid-20th century whose words tended to unsettle people, not offer comfort.
Niebuhr is getting attention again because he has a fan in the Oval Office.
In a widely cited New York Times column, President Obama called Niebuhr his "favorite philosopher." But how precisely has Niebuhr's philosophy influenced Obama and his handling of everything from health care reform to fighting terrorists?
The answer may be seen by looking at Obama's first year in office, several scholars, and a relative of Niebuhr's, suggest.
Who was Niebuhr?
At first, there seems to be little resemblance between the cool, cerebral Obama and the pugnacious Niebuhr.
Niebuhr was a blunt critic of morally complacent Christians. He thought the church was full of idealists who believed that progress was inevitable and that love alone would ultimately conquer injustice, some Niebuhr scholars say.
"He said there was a difference between being a 'fool for Christ' and a plain damn fool," says Richard Crouter, author of the upcoming book "Reinhold Niebuhr: On Politics, Religion and Christian Faith."
Niebuhr lived during an age of global calamities. He was born in Missouri in 1892, the son of a German-born minister. He preached and taught theology during the Great Depression and World War II. He saw the suffering of workers at Henry Ford's auto plant -- lack of pensions, dismissals for sickness -- when he became a pastor in Detroit, Michigan, Crouter says.
"The greed of capitalism and the business class was huge in his mind," Crouter says. "It had to be combated."
So would other forms of evil. Niebuhr wrote movingly about the power of nonviolence. But when Hitler rose to power in the 1930s, Niebuhr drew criticism from Christian pacifists and others for urging the U.S. to enter the war, says Jordan Copeland, an assistant professor of religion at La Salle University in Pennsylvania.
Niebuhr would attract more criticism after the war for supporting "containment," the U.S. Cold War policy of using military, economic and diplomatic force to counter the influence of the Soviet Union, Copeland says.
"He criticized Christian idealists who thought force was never justified and who believed that the law of love was a simple solution to social and political problems," Copeland said. "At times, power must be challenged by power."
Niebuhr distilled his view of human nature in his monumental book, "Moral Man and Immoral Society." The Rev. Martin Luther King Jr. cited the book in his "Letter from Birmingham City Jail." Former President Carter is also an admirer of Niebuhr's.
People are capable of doing good, but groups are driven by "predatory self-interest," Niebuhr wrote.
"As individuals, men believe that they ought to love and serve each other and establish justice between each other," Niebuhr wrote. "As racial, economic and national groups, they take for themselves, whatever their power can command."
How is Obama shaped by Niebuhr?
Tough talk, but how does it give us insight into Obama?
The president's political rhetoric reflects some of Niebuhr's world view, says great-nephew Gustav Niebuhr. He says Obama, like his great-uncle, avoids moral absolutes in his speeches: The U.S. is not always right, and its enemies are not always evil.
Niebuhr says he saw this attitude embedded in Obama's speech to the Arab world in Cairo, Egypt, last year. Obama acknowledged U.S. involvement in helping overthrow a democratically elected government in Iran during the 1950s and avoided "clash of civilizations" rhetoric that implied that the U.S. is free of moral taint.
"We can't see ourselves as the ultimate arbiter for what's good and moral," says Gustav Niebuhr, director of the Religion and Society Program at Syracuse University. "Reinhold would say to do that is to claim a perfectionism that doesn't belong to human beings."
When Niebuhr died in 1971, Gustav had just turned 16. But he still remembers the letters and toys his great-uncle sent him.
Gustav Niebuhr says he's gratified but not surprised that Obama would gravitate to his great-uncle.
"Obama is a very deep-thinking person, from what I can tell," Niebuhr said. "He is very attuned to nuance. I think he's found a philosopher that suits his temperament."
Crouter says he can see Niebuhr's pragmatism and moral complexity in Obama's governing style.
Some Americans became disenchanted by the apparent backstage tradeoffs Obama was accused of making in health care negotiations.
Niebuhr thought, however, that well-meaning people often couldn't get anything done because they preferred to appeal to people's altruism, not their self-interest, Crouter says.
"He thought that sometimes getting your hands dirty with self-interested folks is the only way to make progress," Crouter says. "If you don't believe the Kingdom of God is just around the corner, the best you can sometimes do is take baby steps toward justice."
What Obama said about Niebuhr
In a 2007 interview, Obama explained to David Brooks, a New York Times columnist, what he learns from Niebuhr.
He called Niebuhr his "favorite philosopher," Brooks wrote.
"I take away," Brooks quoted Obama as saying, "the compelling idea that there's serious evil in the world and hardship and pain. And we should be humble and modest in our belief that we can eliminate those things. But we shouldn't use that as an excuse for cynicism and inaction. I take away ... the sense that we have to make these efforts knowing they are hard, and not swinging from naive idealism to bitter realism."
Obama's efforts to balance idealism with realism can be seen in his Nobel Peace Prize acceptance speech in Oslo, Norway, in December, other scholars say.
Obama, a student of the civil rights movement, declared that he was a "living testimony to the moral force of nonviolence." Yet force is necessary at times, he said.
"A nonviolent movement could not have halted Hitler's armies," Obama said. "Negotiations cannot convince al Qaeda's leaders to lay down their arms."
"Niebuhr would have loved that [Oslo] speech," says John Danforth, an Episcopal priest and a former Republican senator who also admires Niebuhr.
"I was very impressed with that speech," Danforth says. "He said you need to deal with terrorists in a very hard-nosed, pragmatic way but hold to American standards."
Yet Danforth says there are critical differences between Obama and Niebuhr.
"I see in Obama's approach to politics, which is surprisingly partisan and ideological, a hubris that is not Niebuhrian," says Danforth, who is also a partner at the Bryan Cave law firm in St. Louis, Missouri.
Niebuhr may still have some lessons to teach Obama.
As the president pivots to his second year in office, there are reports that he is trying to connect better with ordinary Americans. Niebuhr's Serenity Prayer has been doing that for 60 years, says BJ Gallagher, author "It's Never Too Late to Be What You Might Have Been" and an admirer of the Serenity Prayer.
"He saw that religion and theology were real-word issues," Gallagher says. "Theology isn't just for people in church or academe. Theology is for people in their homes, their businesses, their government and their communities. It helps you live your life well."