david cameron (3)
Britain's Prime Minister David Cameron speaks at the Confederation of British Industry (CBI) annual conference in London November 10, 2014. Reuters/Suzanne Plunkett

(Reuters) - Britain's continued membership of the European Union is contingent upon it being allowed to stop migrants from the bloc tapping into its relatively generous welfare system, Prime Minister David Cameron will warn on Friday.

In a speech designed to breathe new life into his campaign to be re-elected in May next year, Cameron will say he wants EU migrants in work to have to wait four years before they can access welfare benefits and for unemployed EU migrants not to be eligible for any help from the British state at all.

With polls showing immigration is voters' top concern, Cameron is under pressure to take a tougher line on the issue. Many of his Conservative lawmakers fear the rise in popularity of the anti-EU UK Independence Party, which this month won its second seat in parliament, threatens their re-election chances.

The speech is likely to upset EU partners such as Poland which has suggested such measures would be discriminatory. But Cameron will not call the EU's freedom of movement rules into question as some EU leaders had feared and will not advocate migrant quotas or an "emergency brake" on inflows.

If re-elected, he has promised to renegotiate Britain's ties with the EU before giving Britons an in/out membership referendum in 2017.

He will make it clear on Friday he thinks his renegotiation will succeed. But he will also drop his strongest hint yet that he may campaign for Britain to leave the bloc if he fails.

“I will negotiate a cut to EU migration and make welfare reform an absolute requirement in renegotiation,” Cameron will say, according to advance extracts released by his office.

“If I succeed, I will, as I have said, campaign to keep this country in a reformed EU. If our concerns fall on deaf ears and we cannot put our relationship with the EU on a better footing, then of course I rule nothing out.”

If implemented, his proposals, which are designed to make Britain a less attractive place for migrant labor, would affect over 300,000 EU migrants, many of them working in low-wage low-skilled jobs.

Welfare payments to EU migrants' children living outside Britain would be stopped and jobless EU migrants would be removed if they were unable to find work within six months.

Nationals from member states joining the EU in future would also be banned from joining the British labor market until their home economies had converged more closely with current members.

Such changes would require the agreement of other EU states and possibly necessitate a change to the bloc's founding treaties, something most countries are reluctant to do.

Under the EU's freedom of movement rules, EU citizens are entitled to work anywhere in the bloc. That has seen hundreds of thousands of EU nationals come to work in Britain, which has the bloc's fastest-growing economy.

Figures published on Thursday showed 228,000 EU citizens had moved to Britain in the year to June alone -- the highest recorded figure -- adding political pressure on Cameron to act.

UKIP and parts of the Conservative party say the public is unhappy about what it perceives to be abuse of the welfare system by unemployed EU migrants and is worried that those migrants who do find jobs are depressing wages.

Britain has already cut access to social security payments for EU migrants this year, tightening the eligibility criteria, increasing the waiting period before migrants are entitled to payments, and halving the length of time for which they can claim unemployment and child benefits.

Cameron is expected to say he wants his proposed changes to apply to the whole of the EU. Failing that, he will say he wants a UK-only settlement.