Media playback is unsupported on your device Media caption David Cameron on EU deal: "What matters is the substance...rather than the timing"

David Cameron has said there is a "a pathway to a deal" on new terms for Britain's membership of the EU after talks with other leaders.

The prime minister set out his reform demands, which include controversial plans to curb access to benefits for migrants, at a dinner in Brussels.

He said "good progress" has been made but it would be "hard work" to get a deal by his February deadline.

German Chancellor Angela Merkel said the leaders "all want a compromise".

Mr Cameron wants to get a new deal before putting the question of the UK's membership of the EU to an in-out referendum of British people by the end of 2017.

He is demanding change on four issues, including stopping in-work benefits for EU migrants in the UK for four years.

BBC political correspondent Alex Forsyth said she understood a number of ideas were "kicked around the dinner table" by the EU's 28 heads of state on Thursday night.

There was suggestion among them that a legally binding agreement - and potentially treaty change down the line - would be possible, she said.

However, officials only had a very short time frame in which to hammer out the technical details by February, she added.

Official conclusions published by the European Council said members had agreed "to work closely together to find mutually satisfactory solutions in all the four areas".

Analysis by the BBC's chief correspondent Gavin Hewitt

Image copyright AFP

All the right soothing words were used during the Brussels evening. David Cameron spoke of "good progress" and "a pathway to a deal" - but for the moment there is deadlock.

The prime minister addressed the other leaders for 45 minutes.

UK officials wanted to point out that this had never been done before, as if the length of his appeal were somehow significant.

Yes, the mood of the meeting was generally positive but the outline of a deal is as elusive as it was.

Read Gavin's full blog

Laura Kuenssberg: Can a deal really be done?

Late on Thursday evening, Mr Cameron emerged from the talks and told reporters a "big step forward" had been taken for a "better deal" for Britain.

"There's still a lot of hard work to be done but there is a path through this," he said.

"There was enormous support in the room for finding changes to keep the UK in the EU...People want to find solutions. There is political will, there is momentum but there is a lot of hard work to be done."

Mr Cameron, who insisted he had not discussed the date of any UK referendum in his speech, added: "In terms of welfare, no, I haven't put any other proposals on the table - I have put my four-year proposal on the table and it remains on the table."

Media playback is unsupported on your device Media caption David Cameron: There is 'path' to EU deal

Defence Secretary Michael Fallon later insisted that the government would not back down on its manifesto commitment to reduce levels of EU migration and would "fight for" the changes it wanted to see - but he stopped short of saying Mr Cameron would insist on a four year benefit ban.

"Britain is deadly serious about reducing the pull, the attractiveness of our benefit system," he told BBC Radio 4's Today, adding that any changes needed to be "irreversible and binding".

'Meaningless'

European Council president Donald Tusk said Mr Cameron had set out his position, particularly on benefits and free movement, and while other leaders had voiced concern they were willing to look for compromises.

"Building on this positive debate we agreed to work together to find solutions in all four baskets raised by Prime Minister Cameron," he said.

German Chancellor Angela Merkel said: "I am optimistic because we all want a compromise. But work on substance needs to be done. Treaty change might be possible. Not now, but perhaps later."

French President Francois Hollande said there could be adjustments over Mr Cameron's demands, but EU rules and principles must be respected.

European Commission president Jean-Claude Juncker warned that all four of Mr Cameron's demands were difficult, and intensive negotiations were needed before February. He said: "I'd like to warn you of the illusory impression that there are three easy questions and one tricky one."

But UKIP leader Nigel Farage, who wants Britain out of the EU, said Mr Cameron "came, saw, and got hammered".

He added: "All he got as a result was a meaningless two sentences in a communique. He was told to come back in February when I suspect he will probably get a few minor concessions."

And Labour MP Kate Hoey, which is leading the Labour Leave campaign, said the talks had not lived up to the "hype" and she feared continuing EU membership would be "the end of the United Kingdom as a totally, independent democratic country".

UK's EU referendum in-depth

Image copyright Getty Images

Q&A: What Britain wants from Europe

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

BBC News EU referendum special report