US President Barack Obama has made an impassioned appeal for Britain to remain in the European Union, saying membership had magnified Britain's place in the world and made the bloc stronger and more outward looking.

Fearful that a British exit could weaken the West, Mr Obama arrived in London yesterday to tell Britons that issues such as terrorism, migration and economic slowdowns could be tackled more successfully with the UK in the EU.

In approaching such a divisive issue, he invoked the interlinked history of the two countries and the tens of thousands of Americans lying in European war graves as his reason for speaking as "a friend" ahead of the 23 June referendum.

"The European Union doesn't moderate British influence – it magnifies it," he wrote in the Daily Telegraph newspaper.

"The United States sees how your powerful voice in Europe ensures that Europe takes a strong stance in the world, and keeps the EU open, outward looking, and closely linked to its allies on the other side of the Atlantic".

Today Mr Obama attended a lunch at Windsor Castle with Queen Elizabeth, who celebrated her 90th birthday yesterday, and her husband Prince Philip.

He also held talks with Prime Minister David Cameron.

Mr Obama's visit is a welcome one for Mr Cameron, who is leading the "In" campaign, but it has drawn scorn from those arguing that Britain should leave the bloc.

Opinion polls indicated that British voters are leaning towards the "In" camp, but many remain undecided.

Speaking ahead of the visit, Mr Cameron said he was "confident that Britain and the US can continue to build on a solid basis of friendship and a shared commitment to freedom, democracy and enterprise to shape a better world for future generations."

The US government, and many US banks and other companies, fear a Brexit would cause market turmoil, diminish the clout of its strongest European ally, undermine London's global financial hub status, cripple the EU and weaken Western security.

New York-born Boris Johnson, the London mayor who heads the "Out" campaign, said he did not want to be lectured by Americans about EU membership and called the President's stance "downright hypocritical".

"For the United States to tell us in the UK that we must surrender control of so much of our democracy - it is a breathtaking example of the principle of do-as-I-say-but-not-as-I-do," he wrote in the Sun newspaper.

Nigel Farage, another prominent opponent of EU membership, said Mr Obama should "butt out".

"This is an unwelcome interference from the most anti-British American president there has ever been. Mercifully, he won't be in office for much longer."