One of German chancellor Angela Merkel's closest allies has firmly rejected David Cameron's proposal to extricate the UK from the EU's commitment to "ever closer union", accusing the prime minister of putting it forward in a "desperate attempt to appease Ukip".

The comments from Gunther Krichbaum, head of the German government's committee on EU affairs, will cast serious doubt on Cameron's ability to deliver on a pledge that he said a week ago was the "most important" change he wanted to see in the UK's relations with Europe.

The remarks, backed by other senior German politicians, come before Thursday's European elections in which the Tories are trying to defuse the Ukip challenge with promises to renegotiate the terms of UK membership in the runup to an in/out referendum by the end of 2017.

A week ago, Cameron said in a BBC interview with Andrew Marr that he would insist the UK was no longer bound by the commitment to "ever closer union", which is one of the core principles of the EU rulebook.

But Krichbaum, a Christian Democrat, told the Observer that in his view the other member states would not agree to the demand, which was central to the operation of the EU.

"I can't imagine that the member states would allow Britain to extricate itself from the 'ever closer union' clause. It looks to me like a desperate attempt on Cameron's behalf to appease Ukip.

"'Ever closer union' is a key element in the fabric of the EU treaty, not least because it is the basis for enhanced cooperation between member states: for example, it allows nine members to come together and cooperate more closely, while other states can hold back. In that respect, Britain already has the opt-out that Cameron now promises: the whole thing is a phantom debate and raises the question about what Cameron really wants.

"It seems his flip-flopping on Europe is now starting to hit back at him. If you want more influence in Europe, then you need closer cooperation. Britain should try to exert more influence in the EU – I for one would welcome it."

In his BBC interview, Cameron said removing the UK from the clause was his No 1 priority. "Perhaps the most important [thing] is getting Britain out of the clause that says the European Union must be committed to an ever closer union."

The prime minister added: "I think it is essential that that doesn't apply to Britain, that the treaties make clear it doesn't apply to Britain."

Cameron prides himself on his close working relationship, and friendship, with Merkel and is hopeful that she will support him. But to secure changes to the terms of UK membership that involved treaty change, Cameron would need the agreement of all 27 other member states. While most Tory MPs welcome Cameron's attempt to renegotiate British membership, and his commitment to an in/out referendum, many are privately sceptical that he will achieve anything substantial.

German government officials said that they would not be commenting officially on the prime minister's comments on "ever closer union".

But the level of opposition among German politicians does not bode well for Cameron.

Axel Schäfer, deputy chairman of the SPD parliamentary group, added that Cameron was "making the people in your country go hysterical".

He said: "Would Germany allow Britain to wiggle out of the 'ever closer union' clause in the Rome treaty? That's out of the question. How could we simply remove such a central plank from the foundation of what Europe is now, from a treaty that has been ratified 500 times by various countries across Europe? There is simply no reason to do so. If Mr Cameron thinks he has Germany and Mrs Merkel on his side on this question, I can assure him that he is wrong."

Elmar Brok, a Christian Democrat MEP, said: "It seems ironic that Cameron is focusing his calls for EU reforms on the phrase 'ever closer union', given that it was only put in the Maastricht treaty thanks to Britain in the first place.

"At the time, we would have preferred the term 'federal Europe', but in Britain that phrase was too problematic: for John Major, it implied centralisation, while for many other European countries it implies decentralisation. So the phrase was only put in thanks to Major.

"If Cameron is still concerned about the language, I would be open to discussions. But you can't suddenly question the basic principles."

The Tories are fighting to avoid heavy losses in the European elections, and could lose as many as 11 of the 26 seats they gained in the European parliament in the last elections in 2009. The Tories, who are expected to come third behind Ukip and Labour, say they are the only party to definitely offer an in/out referendum.

The former prime minister of Luxembourg, Jean Claude Juncker, the candidate of the centre-right European People's party to become the next president of the European Commission, when asked about Cameron's pledge, told the Observer: "All 28 EU member states have signed and ratified a treaty that includes the commitment to ever closer union. I believe that we all should honour our commitments.

"However, I am absolutely convinced that the objective of ever closer union can mean different things for different member states, depending on their situation in relation to the EU. To me, ever closer union is of particular importance for the countries that share the euro as their single currency. The crisis has shown that these countries will need to integrate further to maintain the euro and preserve its stability."

A Conservative spokesman said: "The prime minister has been absolutely clear. He will renegotiate our relationship with the EU – including ever closer union – and give the British people an in-out referendum by the end of 2017. He has held positive talks on his plans with other European leaders."

• Is an outright general election victory finally in sight for the Tories?

• Nick Cohen: Ukip's running scared – all it takes is a good argument

• Ukip byelection candidate backed voluntary repatriation