PALO ALTO, Calif. --- It has been a tough week for President Barack Obama's politics of inclusion and "we're all in it together" globalization.
First came the Supreme Court's action that blocked his plan to protect millions of undocumented immigrants from deportation. Then, just hours later, the United Kingdom voted to withdraw from the European Union, a move that Obama had worked hard to stop.
The two events provided the backdrop as Obama appeared at a White House-sponsored global technology and entrepreneur summit here on Friday that was intended tout the merits of an interconnected world.
Instead, Obama began his remarks to an auditorium packed with 1,700 business leaders by acknowledging some of the forcespulling that world apart.
"I do think yesterday's vote speaks to the ongoing changes and challenges raised by globalization," Obama said to an audience representing 170 countries.
"I believe we are better off in a world in which we are trading and networking and communicating and sharing ideas," he continued. "But that also means that cultures are colliding and sometimes it is disruptive, and people get worried."
At least for the moment, worry, disruption and fear seemed to have the upper hand.
Obama has been preaching for months now - both at home and abroad - that the United States and its allies must resist the impulse to "pull up the drawbridge" on the rest of the world. That belief led him to push for big, multilateral trade deals, reforms to the nation's broken immigration system, and to advocate that the United States provide a haven for refugees fleeing war-torn Iraq and Syria.
Such policies not only reflect America's values but are also critical to the nation's success and the success of its allies in a world that is being remade by automation and advances in technology, the president has argued.
This past few weeks provided some strong evidence that the current might be running against his progressive and inclusive vision.
"The post-World War II liberal project is under siege right now. It's under siege here and in Europe," said Simon Rosenberg, founder of NDN, a liberal think tank. "For those of us who believe in it, the stakes in this fight are very high. We have to recognize this election is going to be about a lot of things in the U.S., but one of things it will be about is . . . whether or not we are entering a different age."
In one forum after another covering a range of issues, Obama has felt compelled over the past few weeks to take on challenges to that liberal order.
He addressed them in the aftermath of the Orlando shooting, when Donald Trump, the presumptive Republican presidential nominee, reiterated his calls for a temporary ban on Muslim immigrants to the United States.
"We are now seeing how dangerous this kind of mind-set and this kind of thinking can be," Obama railed following a meeting with his national security team. "Are we going to start treating all Muslim Americans differently? . . . Do Republican officials actually agree with this?"
He took a similar tone after the Supreme Court's nondecision on immigration Thursday, the biggest legal defeat of his presidency.
"Immigration is not something to fear," he told reporters. "We don't have to wall ourselves off from those who may not look like us right now, or pray like we do, or have a different last name. Because being an American is about something more than that."
And he returned to the subject here on Friday at Stanford University following the United Kingdom's vote, fueled by worries immigration and anti-trade sentiment, to leave the European Union.
Before he took the stage, Obama spoke on the phone with two like-minded allies. He and British Prime Minister David Cameron talked about the need for an "orderly transition out of the E.U." for the U.K. and Cameron's soon-to-come transition out of office. Obama expressed "regret" at Cameron's decision to step aside following leave referendum, aides said. The British prime minister had fought hard to make the case for staying in the E.U. and had concluded that he was out of step with the country he was leading.
Obama then called embattled German Chancellor Angela Merkel, his closest ally on the European continent, who has faced heavy criticism at home for her decision to take in large numbers of Iraqi and Syrian refugees.
All three leaders have been buffeted the by the same forces: growing income inequality, the aftershocks of the great recession, refugee flows, terrorism fears and a rising nationalism that has eroded the liberal international order.
The trends have turned the U.S. into an "increasingly a marginal player" on the world stage, said Ian Bremmer, president of the Eurasia Group, a global political risk consulting firm.
This spring Obama travelled to Europe to rally support for an expansive Transatlantic free trade pact and to urge British voters to stay in the E.U
"It had absolutely zero impact on the polls," Bremmer said. "The United States is not the global leader, but nobody else is either."
Such a state of affairs "leads to geopolitical destruction," Bremmer said. "Everyone is upset with the establishment, and out they go."
Obama by contrast views the anger, fear and anti-immigrant sentiments as a temporary blip. For him, Friday's White House-backed Global Entrepreneurship Summit offered a glimpse of the future he had spent the past seven years working to build.
The president shared the stage with Facebook founder Mark Zuckerberg and three young technology entrepreneurs from Egypt, Rwanda and Peru.
In the audience were 11 budding business leaders from Cuba, the long-isolated communist nation that Obama has been a major foreign policy focus for the president in his second term.
"Hola! Mucho gusto," Obama called out to the Cubans in Spanish. "They're ready to help create new opportunities for the Cuban people."
The young leaders from Cuba, Asia, Africa and the Middle East represented the antithesis of the anti-globalization and nationalist sentiments that had propelled Britain to leave the E.U. "You're the bridge, you're the glue who can help lead towards a more peaceful and more prosperous future that provides opportunity for everybody," Obama told the crowd.
This week, though, even Obama acknowledged that future seemed a little more distant.
• 04/19/16: A cold-eyed view of allies has left President Obama with few overseas friends