British Prime Minister David Cameron faces two months of difficult negotiations in his bid to alter European Union rules ahead of a planned referendum on Britain's continued membership in the EU.

Substantive differences remain, but Cameron and other European leaders said after a grueling negotiating session in Brussels they would search for a compromise ahead of a February summit.

The British leader, who won re-election in May, is under pressure to win concessions from Europe before holding a national referendum on whether Britain should stay in the bloc. Many in his own Conservative Party question the value of remaining in the EU.

Cameron has promised a vote before the end of 2017 but there are indications he hopes to reach an agreement in February and call a vote earlier.

Cameron is calling for a change in rules that would limit the access of workers from other parts of the 28-nation bloc to benefits from the British welfare system. He wants migrants from other EU countries to have to wait four years before claiming benefits.

European leaders say this would be discrimination contrary to the fundamental principle allowing the free movement of people within the EU.

German Chancellor Angela Merkel and French President Francois Hollande both indicated that a compromise is possible but that European agreements must be respected.

Merkel emphasized after the dinner talks that it is necessary to safeguard "core European principles" including non-discrimination and the freedom of movement.

Defense Secretary Michael Fallon told BBC Radio Friday Britain remains "deadly serious" about preventing its benefits system from attracting migrants.

Cameron also seeks an end to the language calling for "ever closer union" among EU members.