EU leaders have agreed to look for a compromise on British Prime Minister David Cameron's controversial reform demands the bloc's president Donald Tusk said.

"Leaders voiced their concerns but also demonstrated willingness to look for compromise," Mr Tusk told a press conference, adding that he was "much more optimistic" than before the discussion.

Mr Cameron's key demand is that EU migrants in Britain must live there for at least four years before they can get welfare benefits but his peers says this is discriminatory and undercuts the core EU principle of free movement.

Asked whether the prime minister now understood this was a red line for his EU counterparts, Mr Tusk said: "For me, the clearest message is that ...  no one, including David Cameron, is ready to accept discrimination."

He stressed that the atmosphere over a summit dinner was good and said the discussions had made "significant progress."

But "we have to be sure that we have to be tough on some red lines and fundamentals," he said.
"We will not give up on free movement".

Among other demands, Mr Cameron wants Brussels to ensure greater protection for non-eurozone member states, an exemption from the EU's goal of "ever closer union" and greater economic competitiveness but these three issues are much less controversial than his migrant welfare limit.

German Chancellor Angela Merkel has made clear she has serious reservations over Cameron's demand while east European members such as Poland and Hungary who have hundreds of thousands of workers in Britain, are strongly opposed.

Mr Cameron said he had made "good progress" on an EU reform deal but warned it would take hard work to get an agreement by February as hoped.

"Really good progress has been made but it is going to be tough," Mr Cameron said, adding that there was a "pathway to a deal in February but the truth is it will be very hard work".

Mr Cameron says that if gets the changes he wants from Brussels, he will campaign for a 'Yes' vote on Britain's membership in a referendum he has promised by 2017.

If he fails, he says "all options are open."

Britain will hold an in-out referendum on EU membership before the end of 2017.

Chancellor Angela Merkel said it would be difficult to meet British demands for changes to EU rules on benefits for migrants but that there was a will among all member states to get a deal.
"We made it clear that we are ready to compromise, but always on the basis that we safeguard the core European principles, which include non-discrimination and free movement.
"Especially regarding the fourth pillar [on welfare benefits] it won't be easy but I still think that with good will we can find good solutions," she added.