The week began with President Obama on the tarmac of a military base in Maryland, waiting to welcome a global celebrity far more popular than he. It ended with him raising a toast to a hard-nosed world leader who has repeatedly challenged American interests and Obama’s resolve.

Along the way, the president’s most frequent legislative sparring partner in Washington relinquished his post on Capitol Hill, finally surrendering to the sharp polarization that has come to define American politics in the past five years. And abroad, another of Obama’s persistent antagonists — the Russian president — suddenly wanted a face-to-face chat about Syria and Ukraine.

The week’s events seemed like political surrealism. When Pope Francis arrived at the White House on Wednesday, the weather was so gorgeous it put Obama in a hopeful, reverential mood.

“What a beautiful day the Lord has made,” he said.

Two days later, Chinese President Xi Jinping arrived on the South Lawn to a much stiffer, more martial ceremony, complete with a 21-gun salute and lengthy remarks read from thick binders. Behind the scenes, the two leaders grappled over questions of economic hacking and Beijing’s military adventurism in the South China Sea.

From his private meeting with President Obama to giving the first-ever papal address before a joint session of Congress, Pope Francis did not shy away from politics during his three-day stop in Washington, D.C. (Julie Percha/The Washington Post)

But amid the piety of the pope and the provocations by China loomed the potential of another government shutdown. The surprise announcement by House Speaker John A. Boehner (R-Ohio) on Friday that he would step down provided the week’s surpassing piece of political drama.

In Obama, Boehner has faced a determined adversary, but it was a mutiny within his own caucus that finally drove him to the exit. And as tempestuous as the Obama-Boehner relationship has been, the speaker’s departure signals that Obama may face an even more fractious GOP majority Congress in the remaining months of his presidency.

More than some of his predecessors, Obama is acutely aware of the contrast between his lofty ideals and the reality facing him. He talks about it all the time.

“Ultimately, global leadership requires us to see the world as it is, with all its danger and uncertainty,” the president told graduates of the U.S. Military Academy at West Point in May 2014. “But American leadership also requires us to see the world as it should be — a place where the aspirations of individual human beings really matters ; where hopes and not just fears govern; where the truths written into our founding documents can steer the currents of history in a direction of justice.”

The past week was a single lens into both those worlds, with their maddeningly uplifting complexity.

In Francis — and his progressive message on inequality, immigration and climate change — Obama saw the world as he wanted it to be. In everything else — Xi’s visit, Boehner’s resignation and a decision to meet with Russian President Vladi­mir Putin during the upcoming U.N. General Assembly session in New York — the president faced the world as it really is.

Both President Obama and President Xi Jinping referenced the evolving relationship between their two counties during a toast at the Chinese state dinner on Friday. (AP)

The president has had only a modest impact on three of the protagonists who dominated the week, although he has sought to engage all of them at different points. Xi and Obama have found a common cause in tackling climate change, but on many other important policy issues, they are at odds. Putin, like Xi, has joined the United States in pressuring Iran to scale back its nuclear program. But he defied American calls to respect Ukraine’s sovereignty and has ignored the U.S. push to sideline Syrian President Bashar al-Assad as part of a political solution to the ongoing Syrian civil war. Obama sought to enlist Boehner’s help in forging fiscal and immigration reforms, but the GOP leader was never able to bring along enough members of his party to make the deals happen.

Still, Obama was at the center of all of the action over the past week.

Stanford University’s Michael McFaul, who served as U.S. ambassador to Russia for three years under Obama, returned a few days ago from Beijing. He said he was struck by the massive coverage in China of Xi’s visit to the United States, as he was by Putin’s desire to speak with Obama during the U.N. meeting. China’s and Russia’s dealings with the United States rank as each of those countries’ “most important bilateral relationship,” he said.

“It seems to me [Obama is] still pretty engaged in international affairs, and people want to engage him,” said McFaul, who directs Stanford’s Freeman Spogli Institute for International Studies. “We’re still the central power in the international arena.”

During a news conference with Xi in the White House Rose Garden on Friday, Obama delivered a brief lecture on the many responsibilities that accompany China’s rise from the “poor, developing country” it once was to its current status.

“It is now a powerhouse. And that means it’s got responsibilities and expectations in terms of helping to uphold international rules that might not have existed before,” the president said.

But on several issues, Xi asserted that China would not mimic other world powers. “Democracy and human rights are the common pursuit of mankind,” he said. “At the same time, we must recognize that countries have different historical processes and realities, and we need to respect people of all countries in the right to choose their own development path independently.”

Although the White House has emphasized the value of the time Obama and Xi have spent “outside the glare of the klieg lights,” in the words of press secretary Josh Earnest, experts cautioned that that sort of schmoozing has its limits.

Patrick M. Cronin, senior director of the Asia-Pacific Security Program at the Center for a New American Security, said there’s an “American tendency to believe in the personalization of relations.”

“It’s all generally true, but the president of China doesn’t come as a person,” he said. “He comes here as the leader of the Communist Party, and the leader of China.”

Obama’s exchanges with the pope were less charged.

Obama and Francis chatted amiably as the choir of Washington’s St. Augustine Catholic Church sang “Total Praise” on the South Lawn, and in their public remarks, the president and the pontiff emphasized their common values.

The pope said he found it “encouraging” that Obama was cutting carbon emissions linked to climate change. Meanwhile, the president not only praised Francis’s vision of “empathy,” but also said his “unique qualities as a person” gave the world “a living example of Jesus’s teachings, a leader whose moral authority comes not just through words but also through deeds.”

On Friday, after word of Boehner’s resignation became public, Obama said he hoped lawmakers would “really reflect on what His Holiness said,” especially the idea “that we listen to each other and show each other respect, and that we show regard for the most vulnerable in society.”

Seven decades ago, with Eastern Europe in turmoil, Soviet leader Joseph Stalin dismissed the Vatican’s influence in the world with this question: “How many [military] divisions does the pope of Rome have?”

Michael Ignatieff, a professor at the Carr Center for Human Rights Policy at Harvard’s Kennedy School, described Obama as “a realist and a pragmatist” with reasons to align himself with Francis.

“A ‘realist’ fact about the modern world is Pope Francis has divisions,” said Ignatieff, who led Canada’s Liberal Party in opposition between 2008 and 2011. “He has articulated a longing for justice, the care of nature, the care of the poor — that’s very powerful stuff.”