Barack Obama has intervened in European Union referendum to say he is looking forward to the UK remaining a member.

The American President's prediction, at least a year before the actual vote, is expected to infuriate Eurosceptics.

Similar comments expressing his hopes that Scotland stay within the UK angered nationalists in the run up to last year's independence referendum.

Mr Obama's remarks came as he met Prime Minister David Cameron for talks during the G7 summit of world leaders in Schloss Elmau, Germany.

Mr Obama said: "I would note that one of the great values of having the United Kingdom in the EU is its leadership and strength on a whole host of global challenges.

"So we very much are looking forward to the United Kingdom staying part of the EU because we think its influence is positive not just for Europe, but also for the world."

Meanwhile, Mr Cameron has risked a split in Cabinet by telling ministers who want to campaign to leave the EU they will have to resign.

The Conservative leader said that "everyone in Government" would have to support his position in the referendum.

Earlier Eurosceptic members of a new campaign group said they were prepared to back a 'Brexit' unless Mr Cameron secured-wide ranging reforms from other European leaders.

At the summit Mr Cameron said he was "confident" he would secure the changes needed.

But he added: "I've been very clear. I have said that if you want to be part of the Government you have to take the view that we are engaged in an exercise of renegotiation, have a referendum and that will lead to a successful outcome.

"Everyone in Government is signed up to the programme set out in the Conservative manifesto," he said.

Former Tory cabinet minister Lord Heseltine appeared to agree with Mr Cameron's stance, saying it would be "chaotic" if ministers campaigned against the Government.

But others had hoped that ministers would be given a free vote.

Last week Tory 'big beast' Ken Clarke called on the Prime Minister to allow Cabinet ministers to campaign on either side in the referendum.

David Campbell Bannerman MEP, the new chair of the Conservative for Britain group, predicted that there would be resignations.

He told the BBC's Pienaar's Politics there were up to nine members of the4 Cabinet "who have a lot of principle on this issue... I think whipping could cause issues. Ministers should be allowed to say what they want to say."

Mr Obama also pressed Mr Cameron to maintain Britain's commitment to meeting the Nato target to spend 2 per cent of GDP on defence.

Mr Cameron has steadfastly declined to pledge to meet the target beyond March 2016, saying that any decision must await the outcome of Chancellor George Osborne's Spending Review.

A Downing Street source said that Mr Obama had "touched on" the issue during discussions between the two men.

"The president underlined the importance of the UK and US as the two pillars of Nato, and said he accepted the fiscal challenges but hoped that the UK would find a way to meet it," said the source.

Asked if Mr Cameron had offered assurances, the source declined to "give a running commentary", but said the PM had pointed to the military operations around the world to which Britain has contributed.