LONDON (Reuters) - Nearly half of Britons are leaning toward voting to leave the European Union at a membership referendum due by the end of 2017, according to a survey published on Thursday.

Prime Minister David Cameron will hold talks with other European Union leaders in Brussels on Thursday to try to end an impasse over his attempts to win better membership terms ahead of the vote.

The survey funded by Michael Ashcroft, a former deputy chairman of Cameron’s Conservatives, asked more than 20,000 people to place themselves on a scale between zero and 100, with zero meaning they would definitely vote to remain in the bloc and 100 meaning they would definitely vote to leave.

It found 38 percent were inclined to remain, putting themselves between 0-49, while 47 percent were leaning toward leaving, placing themselves between 51-100. Ashcroft said 14 percent were completely undecided, placing themselves at 50.

Ashcroft said a quarter of voters, questioned between Nov. 20 and Dec. 2, said they did not have a strong view and could easily be persuaded to change their minds however.

Thirty-five percent said they would be more inclined to vote to remain if Cameron announced he had secured a better deal for Britain as a result of his renegotiation.

Asked what the biggest issues were at stake in the debate over Britain’s continued membership, immigration was the most popular answer, followed by control of borders.

Cameron is facing an uphill battle to secure agreement on his proposal to curb some welfare payments to EU migrant workers, with other EU leaders warning it would discriminate on grounds of nationality and therefore would be against basic EU law.

While 39 percent of those surveyed said Britain would never be able to bring immigration under control unless it left the bloc, a similar number, 37 percent, said they thought Britain wouldn’t be able to control its immigration even outside the EU.

Voters were fairly evenly divided on the risks of so-called Brexit, with 53 percent saying leaving the EU carried a greater risk to Britain than remaining, and 47 percent believing the opposite.