PALO ALTO, Calif. (Reuters) - U.S. President Barack Obama on Friday tried to limit the fallout from Britain’s vote to leave the European Union, which threatens to harm the U.S. economic recovery, derail his trade agenda and distract U.S. allies from global security issues.

U.S. President Barack Obama speaks about Brexit at the Global Entrepreneurship Summit at Stanford University in Palo Alto, California, June 24, 2016. REUTERS/Kevin Lamarque

Obama, who had argued passionately against Britain leaving the EU in a trip to the country this year, vowed that Washington would still maintain both its “special relationship” with London and close ties to Brussels.

“While the UK’s relationship with the EU will change, one thing that will not change is the special relationship that exists between our two nations. That will endure,” he told an event at Stanford University, referring to close ally Britain. “The EU will remain one of our indispensable partners,” Obama said.

He spoke to outgoing British Prime Minister David Cameron and German Chancellor Angela Merkel after the stunning result of Thursday’s referendum, the biggest blow to the European project of greater unity since World War Two.

Obama said he was sure Britain’s exit would be orderly and vowed that the United States and Britain would “stay focused on ensuring economic growth and financial stability.”

The Brexit result rattled Wall Street and many other financial markets, with global stock markets losing about $2 trillion in value on Friday.

“I must say we had looked for a different outcome. We would have preferred a different outcome,” U.S. Vice President Joe Biden, traveling in Ireland, said on Friday.

The historic divorce launched by the Brexit vote could sink hopes of a massive U.S.-EU free trade deal before Obama leaves the White House in January.

Negotiations on the Transatlantic Trade and Investment Partnership, or TTIP, were already stalled by deeply entrenched differences and growing anti-trade sentiment on both continents.

As well as the global economic consequences, Brexit makes it more difficult for Obama and the United States to corral its Western allies into joint action against challenges such as Islamic State, Russia and the rise of China.

Britain’s exit could present the next U.S. president with a decision on whether to turn to other key European partners like Germany and France, essentially downgrading the United States’ special bond with Britain, whose foundation was laid in World War Two.

Senator Ben Cardin of Maryland, the top Democrat on the Senate Committee on Foreign Relations, called on Washington’s partners in Europe to keep their eye on foreign policy threats.

“We must maintain our trans-Atlantic consensus on how to deal with a resurgent Russia and the growing threat of ISIS,” he said. “I urge leaders in London, Brussels and across Europe to not lose sight of these threats and remain coordinated in our response.”

THE TRUMP FACTOR

The U.S. presidential election candidates are casting an eye across the Atlantic at the unlikely success of Britain’s “Leave” campaign, which has similarities with Republican Donald Trump’s insurgent bid for the Nov. 8 election.

Trump’s rise was sustained by a similar brew of anti-establishment and anti-globalization sentiment and concern about immigration that helped the Leave vote.

“This is a protest vote against globalization and there is one presidential candidate who won the nomination who has put globalization in his crosshairs - and that’s Donald Trump,” Republican strategist John Feehery said.

Biden, in remarks prepared for a speech at Dublin Castle, took a swipe at Trump without mentioning him by name. He warned against “politicians and demagogues peddling xenophobia, nationalism, and isolationism.”

Brexit supporter Trump called the result a “great thing.” “People want to take their country back. They want to have independence in a sense. You see it with Europe, all over Europe,” Trump, 70, said in Turnberry, Scotland where he reopened a golf course.

Republican Senator Jeff Sessions said Britain’s electoral shock showed that national leaders will be punished if they do not “first ensure they have protected the safety and legitimate interests of their own people.”

“Brexit is a warning for America,” said Sessions, a Trump supporter who criticized “radical trade policies that erode the power of the people to control their lives.”

Obama had warned British voters against Brexit, in an unusually strong intervention into British politics in April.

The White House said on Friday that he stands by a comment made then that Britain would move to the back of the queue when it comes to trade deals with the United States if it left the EU.

Obama hopes his former secretary of state Hillary Clinton will win the November election and safeguard his legacy but economic volatility in the United States after Brexit could hurt her chances of beating Trump.

In response to Britain’s decision to leave, Clinton said the United States must first safeguard against any economic fallout at home at “this time of uncertainty” and underscore its commitment to both Britain and Europe.

The U.S. Federal Reserve sought to calm global financial markets by saying it was ready to provide dollar liquidity following the British vote.

U.S. financial regulators said the country’s financial system is functioning in an “orderly manner.”

The Financial Stability Oversight Council - which includes the heads of the U.S. Treasury, Securities and Exchange Commission and Federal Reserve - “noted that the U.S. financial system continues to function in an orderly manner, and that the Council will continue to monitor ongoing developments,” according to a summary released after a phone call among members.

After Brexit, the U.S. central bank’s ambitions for two rate rises this year now look unlikely. Traders of U.S.-interest rate futures even began to price in a small chance of a Fed rate cut, and now see little chance of any hike until the end of next year.

“One can forget about rate hikes in the near term,” said Thomas Costerg, New York-based economist at Standard Chartered Bank. “What I’m worried about is that the Brexit vote could be the straw that breaks the back of the U.S. growth picture.”