Photo: Obama with some members of British royal family( Reuters)

United States President Barack Obama has been accused of doing Downing Street’s bidding – after he said the United Kingdom (UK) would be at “the back of the queue” for American trade deals if it left the European Union ( EU).

Mr Obama was criticised by pro-Brexit campaigners after he warned of the consequences of the UK leaving the EU.

UKIP’s Nigel Farage said Mr Obama was “talking down Britain”, while Tory Liam Fox said his views were “irrelevant”.

Mr Obama, on a three-day UK visit, will meet Labour leader Jeremy Corbyn later.

In a speech in London, the US president urged young people to “reject pessimism and cynicism” and to “know that progress is possible and our problems can be solved”.

“Progress is not inevitable,” he said and must be fought for. “Take a longer, more optimistic view of history.”

Mr Obama’s intervention on the EU issue came on his first full day in the UK and comes just weeks ahead of the 23 June in-out referendum.

Speaking at a joint news conference with Prime Minister David Cameron on Friday, Mr Obama said the US “wants Britain’s influence to grow – including within Europe”.

“The UK is at its best when it’s helping to lead a strong European Union. It leverages UK power to be part of the EU.

“I don’t think the EU moderates British influence in the world, it magnifies it.”

BBC political correspondent Iain Watson said Mr Obama’s message on trade was “very blunt” and “really upped the ante” in the referendum debate.

Leave campaigner Mr Farage drew attention to the US president’s terminology, saying his use of the phrase “back of the queue” rather than the more common American vernacular “back of the line” suggested Mr Obama was doing the prime minister’s “bidding”.

“I think that’s shameful,” he added.

Mr Fox said Mr Obama would be leaving the White House soon, and therefore his comments were “largely irrelevant”.

Conservative MP Dominic Raab labelled Mr Obama a “lame-duck American president doing an old British friend a political favour”.

Downing Street rejected suggestions that any lines had been fed to Mr Obama, saying the US president spoke for himself.

Sir Andrew Cahn, a former chief executive of UK Trade & Investment, told BBC Radio 4’s Today programme that Britain would “miss out on something very important and valuable” if it left the EU and was not part of a proposed trade deal between the bloc and the US.

Former foreign secretary Lord Owen said “Britain needs to create new markets away from the EU”.

London Mayor Boris Johnson has said that he finds the US’s “lectures” on EU referendum “paradoxical [and] very odd”

Meanwhile, another prominent Leave campaigner – former cabinet minister Iain Duncan Smith – has tried to move the referendum debate on to immigration.

In an article in the Daily Mail, he says the introduction of a national living wage – a move he supported while in government – will “surely lead to another stampede to our borders”.

He adds: “To make the Living Wage work for British people, we need to be able to control the number of people coming in.”