Media playback is unsupported on your device Media caption David Cameron: "My policy is to hold a renegotiation and a referendum... and abide by what the British public say"

David Cameron says he is "hopeful" of reaching a deal with European leaders in February that will allow him to hold the UK's EU referendum.

The prime minister said the in-out vote "would follow" if agreement was reached on his reforms at next month's summit.

He also said he would stay on as PM even if he ended up on the losing side.

He told Andrew Marr he did not think a UK exit was "the right answer" but promised "everything necessary to make it work" if there was a vote to leave.

The in-out referendum has been promised by the end of 2017.

Asked whether he was suggesting the referendum could be held this summer, Mr Cameron said: "That is what I would like to see, is a deal in February, then a referendum that would follow".

It would take place "later" if no agreement was reached, he said.

Analysis

By Iain Watson, BBC political correspondent

The prime minister's tone in his BBC interview was markedly positive when he discussed continued EU membership.

He said the best answer for Britain would be to stay in a reformed EU.

And it was because he was now so close to a deal that he had announced that ministers would be free to campaign on either side of the debate.

He reiterated that he wouldn't resign if he was on the losing side - understandable, perhaps, as he wants the referendum to be about EU membership and not about his own leadership.

While he still maintained that he wouldn't rule out leaving the EU, senior Eurosceptics in his party believe it's inconceivable he will do anything other than recommending a vote stay in.

Q&A: The UK's planned EU referendum

Q&A: What Britain wants from Europe

Mr Cameron reiterated his desire to campaign for the UK to remain in a reformed EU, but said he would rule nothing out if his demands were refused.

Welfare freeze

On the question of whether he would stay on as PM if he ended up on the losing side, he said: "The answer to that question is yes."

He said his priority was to hold a referendum and to "abide by what the British public say".

The question put to voters would be whether to stay in or leave the EU, he said, not "this politician's future or that politician's future".

One of his key proposals - a four-year freeze on in-work benefits for EU migrants - has met with stern opposition from his European counterparts, but Mr Cameron said it was still on the table until an "equally powerful and meaningful" alternative was proposed.

Asked whether the measure could be extended to UK nationals to overcome the opposition, he replied: "When I have got an announcement to make I will make it."

David Cameron's four main aims for renegotiation

Image copyright PA

Economic governance : Securing an explicit recognition that the euro is not the only currency of the European Union, to ensure countries outside the eurozone are not disadvantaged. The UK wants safeguards that it will not have to contribute to eurozone bailouts

: Securing an explicit recognition that the euro is not the only currency of the European Union, to ensure countries outside the eurozone are not disadvantaged. The UK wants safeguards that it will not have to contribute to eurozone bailouts Competitiveness : Setting a target for the reduction of the "burden" of excessive regulation and extending the single market

: Setting a target for the reduction of the "burden" of excessive regulation and extending the single market Immigration : Restricting access to in-work and out-of-work benefits to EU migrants. Specifically, ministers want to stop those coming to the UK from claiming certain benefits until they have been resident for four years.

: Restricting access to in-work and out-of-work benefits to EU migrants. Specifically, ministers want to stop those coming to the UK from claiming certain benefits until they have been resident for four years. Sovereignty: Allowing Britain to opt out from further political integration. Giving greater powers to national parliaments to block EU legislation.

Guide to the UK's planned in-out EU referendum

BBC News EU referendum special report

The prime minister also played down reports of a deal involving Nato troops being based in Poland in exchange for support on his proposals, saying it had not been raised in any of the conversations he had been involved in.

Ministers are to be allowed to campaign for either side in the referendum once negotiations are complete, a measure Mr Cameron said he had always intended to take and described as "fair, sensible and reasonable".

'Disgraceful'

A number of cabinet ministers are thought to favour an out vote.

One source told BBC political correspondent Ross Hawkins there was "growing disquiet" among Eurosceptic cabinet ministers that they did not have a chance to fairly state their views, while their pro-European colleagues could speak freely.

One Eurosceptic cabinet minister said Mr Cameron and the government needed to be careful to be seen to be fair, but thought some concerns in the press had been overplayed, he added.

Speaking on BBC Radio 5live's Pienaar's Politics, senior Conservative backbencher David Davis said he would be voting to leave, and that nothing the prime minister said in his interview had convinced him otherwise.

He predicted most of his backbench colleagues would "probably" join him in voting for a "Brexit".

Mr Davis also said it was "disgraceful" that contingency plans were not being made inside government for a UK exit from the EU.

"It's a very complicated operation to carry out if it happens," he added.

The Leave.EU campaign said: "The sooner the prime minister produces his worthless deal the better - then we can move on to the genuine campaign and the British people can at last have their say and leave the outdated political circus that the EU has become."