London (CNN) -- European leaders have warned Britain against the dangers of cherry-picking European Union policy after David Cameron announced Britain would hold a referendum on its European Union membership if his Conservative Party is re-elected in 2015.
Ahead of the British prime minister's speech, U.S. President Barack Obama had also advised Cameron that the United States valued Britain's membership of the European bloc.
However, Cameron used Wednesday's speech in central London to say Britons should have a choice about whether to remain in the EU on the basis of a renegotiated settlement.
He promised to hold a referendum by the end of 2017.
After Cameron's speech, the President of the European Parliament Martin Schulz tweeted: "#Cameron's Europe a la carte not an option. We have to focus on jobs & growth rather than getting lost in treaties discussions."
"We need a #UK as a fully fledged member not harboring in the port of Dover. UK can shape #EU by working with its partners," the German politician said.
French Foreign Minister Laurent Fabius used similar language in an interview on France Info radio saying Europe could not be "a la carte," Agence France-Presse (AFP) reported.
"Imagine the EU was a football club: once you've joined up and you're in this club, you can't then say you want to play rugby," it quoted him as saying.
"It risks being dangerous for Britain itself because Britain outside of Europe, that will be difficult," Fabius said.
German Chancellor Angela Merkel told reporters that being part of Europe involved compromise.
"Europe also always means that you have to find fair compromises. In this context, we are of course ready also to talk about British wishes but one must keep in mind that other countries also have other wishes," Merkel said.
German Foreign Minister Guido Westerwelle told reporters his country wanted Britain "to remain an active and constructive part of the European Union" and warned against "cherry-picking."
"We strive to create a better Europe, the European Union becoming even stronger with overcoming the debt crisis and regaining global competitiveness," AFP quoted him as saying.
"We share a common destiny in challenging times of globalization. And in challenging times of globalization, we as Europeans, we are all in the same boat."
EU Commission spokeswoman Pia Ahrenkilde Hansen told it was "very much in the EU's interest and UK's interest" that London remain "an active member."
Ireland's Deputy Prime Minister Tanaiste Eamon Gilmore said Britain's membership of the EU was in both parties' best interests.
"And as far as Ireland is concerned, because of our close connections with Britain, we want to see Britain as a fully engaged member of the EU," the Press Association (PA) quoted him as saying.
Former Belgian prime minister Guy Verhofstadt warned against trying "hold the EU to ransom."
The leader of the Alliance of Liberals and Democrats for Europe in the European Parliament said Cameron's speech was "filled with inconsistencies" and showed "a degree of ignorance about how the EU works."
"By holding out the prospect of renegotiating the terms of Britain's membership of the EU and subjecting it to a referendum, David Cameron is playing with fire.
"He can control neither the timing nor the outcome of the negotiations and in so doing is raising false expectations that can never be met."
Obama last week told Cameron that "the United States values a strong UK in a strong European Union."
Philip Gordon, the U.S. assistant secretary for European affairs, also made it clear that there would be consequences for Britain if it either left the EU or played a lesser role in Brussels.
"We have a growing relationship with the EU as an institution, which has an increasing voice in the world, and we want to see a strong British voice in that EU," he told reporters at the U.S. Embassy in London.
"That is in America's interests. We welcome an outward-looking EU with Britain in it."
The New York Times reported Wednesday that the implications of Cameron's speech had "alarmed" the Obama administration and were likely to set up "a divisive debate within Britain and across Europe."
Deutschewelle's Europe Editor Joanna Impey wrote that leaving the EU would "not insulate the UK from the crisis in the eurozone."
"The EU is Britain's biggest trading partner, and it makes sense to remain within the bloc and to be able to make the rules rather than simply abide by them," she said.
But Impey added that the Conservative Party would need to be re-elected for the referendum to go ahead.
A Downing Street spokeswoman said criticism of Cameron's referendum plan could be expected.
"But it is not always our job to worry about what the foreign ministers are saying," she told PA.
"It is our job to worry about what the British people are saying."
Deputy Prime Minister Nick Clegg -- whose Liberal Democrat party is in coalition with Cameron's Conservatives -- told PA a referendum was not in the national interest.
In Britain's House of Commons, Labour Party Leader Ed Miliband said he was opposed to an in/out referendum.
Former British Prime Minister Tony Blair, speaking at the Davos summit, told Sky News he did not see "a compelling reason" to put the question of Britain's EU membership on the agenda.
"Europe does need Britain and Britain needs Europe," Blair said. "Why say we're actually going to put on the agenda the prospect of leaving Europe altogether?"