LONDON — President Obama has called on the British people not to vote for an exit from the European Union, writing in an opinion article published upon his arrival in London late Thursday night that “the European Union doesn’t moderate British influence — it magnifies it.”

In the article in The Telegraph, Mr. Obama, making a case he has made numerous times before in Washington, wrote that the United States would prefer Britain to remain a full member of the European Union. Britons will vote on June 23 in a referendum on whether to remain in or leave the bloc. The last such referendum was in 1975, and Britons voted by nearly two to one to stay.

But the vote is expected to be closer in June, and some prominent British advocates of quitting the European Union have criticized Mr. Obama’s intervention. London’s mayor, Boris Johnson, one of the public leaders of the campaign for Britain’s exit, has accused Mr. Obama of hypocrisy because the United States does not share sovereignty with its neighbors the way Britain now does with the European Union.

In the article, Mr. Obama responded directly to that criticism, asserting that the challenges facing Europe are not different from the ones facing the United States.