Prime Minister David Cameron has warned Eurosceptic ministers they will have to resign if they want to campaign to leave the EU, saying the government will not be "neutral" on the issue.

Cameron made the remarks while speaking at the G7 leaders' summit in Germany where he said the government's position on the EU had been outlined in the Conservative manifesto.

"If you want to be part of the Government you have to take the view that we are engaged in an exercise of renegotiation to have a referendum and that will lead to a successful outcome," he said.

"Everyone in government has signed up to the programme set out in the Conservative manifesto."

"The Government isn't neutral in this. We have a clear view: renegotiate, get a deal that's in Britain's interest and then recommend Britain stays in it."

The Prime Minister also said the final date for Britain's EU referendum was dependent on a number of factors but that he had not ruled out holding the vote in one year's time on May 5 2016, Associated Press reported.

The Electoral Commission gas advised the government to avoid a clash with elections on that date to the Scottish Parliament, Welsh Assembly and for the London Mayor and English council elections.

"My view is that we should hold the referendum when we've completed the negotiation. On whether it should be with other elections or not, I take a very open-minded view.

"Personally, I think the British public are quite capable of going to a polling booth and making two important decisions rather than just one, and I think the evidence has shown that.

"But what will determine the timing of the referendum is not the timing of other elections. What will determine the timing is the outcome of the negotiation, but with that deadline at the end of 2017."

Cameron will face stern opposition within his own party on the EU referendum, particularly from At least 50 Tory MPs, including former Cabinet ministers Owen Paterson and John Redwood, who have signed up to the newly-formed Conservatives for Britain block.

US president Barrack Obama also addressed the subject of a possible Brexit at the G7. Giving a ringing endorsement for Britain to remain in the EU,

He said "I would note that one of the great values of having the United Kingdom in the European Union 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 European Union because we think its influence is positive not just for Europe, but also for the world."