San Francisco (AFP) - President Barack Obama, who had warned against Britain quitting the European Union, said Friday that Washington would respect the British voters' decision to do just that.

The US leader said Britain and the European Union would both remain "indispensable partners" of the United States and that the "special relationship" with London would endure.

"The people of the United Kingdom have spoken, and we respect their decision," Obama said, in a statement from his White House office echoed by presumptive Democratic presidential nominee Hillary Clinton.

But, in a nod to Washington's frustration that its ally has been unwilling to back a European project seen as a cornerstone of Western power, Obama also paid tribute to the EU.

"The special relationship between the United States and the United Kingdom is enduring, and the United Kingdom's membership in NATO remains a vital cornerstone of US foreign, security, and economic policy," he said.

"So too is our relationship with the European Union, which has done so much to promote stability, stimulate economic growth, and foster the spread of democratic values and ideals across the continent and beyond," he said.

"The United Kingdom and the European Union will remain indispensable partners of the United States even as they begin negotiating their ongoing relationship to ensure continued stability, security, and prosperity for Europe, Great Britain and Northern Ireland, and the world."

Clinton also stressed "America's steadfast commitment to the special relationship with Britain and the transatlantic alliance with Europe."

"This time of uncertainty only underscores the need for calm, steady, experienced leadership in the White House to protect Americans' pocketbooks and livelihoods, to support our friends and allies, to stand up to our adversaries, and to defend our interests," she said.

"It also underscores the need for us to pull together to solve our challenges as a country, not tear each other down."

Story continues

The statement clearly alluded to her Republican rival Donald Trump, who hailed the British vote as "a fantastic thing" that had parallels with his own presidential campaign.

"People want to take their country back, they want independence," Trump said in Scotland, where he was visiting one of his golf courses.

Clinton said she respected the choice made by the people of Britain, but said the first US priority should be to "make sure that the economic uncertainty created by these events does not hurt working families here in America."