Britain must regain control of its borders or quit the European Union, Boris Johnson warned yesterday.

The London Mayor said it was a ‘deception’ to claim Britain could control immigration while diktats from Brussels over freedom of movement were in place.

His comments were seen as a criticism of the Prime Minister who had said he would cut net migration to the tens of thousands – even though he had no control over the number of EU workers flooding in.

Mr Johnson said reclaiming control over our borders should be the ‘number one’ priority in the renegotiation with the EU.

Boris Johnson took aim at Labour's Tony Blair for opening Britain's borders to Poland in 2004, but also David Cameron's pre-election pledge to cut immigration to the tens of thousands.

He said David Cameron should be brave enough to lead the campaign to walk out of the EU in the 2017 referendum if Brussels fails to cede enough powers.

His tough words on immigration come just days after Ukip surged to victory in the Clacton by-election and came close to winning the Labour seat of Heywood and Middleton in the North West. And they came amid claims the Prime Minister could face a leadership challenge if he loses another seat to Ukip.

The mayor told the BBC’s Andrew Marr show that the Tories under Mr Cameron had been guilty of ‘deception’ over immigration because of Europe’s open borders.

He said it had been wrong for the party to claim at the last election that it was possible to control immigration from the EU.

Challenging Mr Cameron to be tougher in his negotiations with Brussels, he said: ‘It’s obviously axiomatic that if we don’t get the reform that we need in 2016-17 then I think we should campaign to come out.

‘But on the border controls thing; that is critical. That is emerging as the number one thing that we need probably to sort out in this negotiation.’

The London Mayor insisted that if Mr Cameron's plans to claw powers back from Brussels fail, he would back Britain leaving the EU altogether

The Prime Minister has promised to claw back powers over our borders as part of his promised renegotiation of powers ahead of an in/out referendum by the end of 2017.

Yesterday Mr Johnson said that if this was not achieved, he would campaign for us to come out of Europe. Asked if Mr Cameron should promise to lead the Out of EU campaign if the negotiations do not go well, the mayor said: ‘Yes, I do think that.’

He said there had been two ‘big deceptions’ over the past decade; the first being Tony Blair’s opening of the borders to Eastern Europeans in 2004 when other countries imposed restrictions.

The other, he said, was ‘saying we could control the numbers when we couldn’t’. This was seen as a reference to Mr Cameron’s pledge at the last election to cut migration from the hundreds of thousands to the tens of thousands.

While the number of people leaving the UK has remained at around 80,000, the numbers arriving from the EU have risen sharply

Net migration from EU countries has risen sharply in recent years, hitting 131,000 in the 12 months to March 2014, according to data from the Office for National Statistics

Despite the Prime Minister’s immigration pledge, the numbers arriving each year have continued to top 200,000, fuelled mostly by large numbers from the EU.

Meanwhile, it emerged that one Cabinet minister believes that Mr Cameron could face a leadership ballot if the Tories lose next month’s Rochester and Strood by-election to Ukip. Former Tory MP Mark Reckless is standing for Ukip there after defecting last month. The minister was quoted as saying: ‘If Reckless wins Rochester, there’ll be 46 names.’

This is a reference to the 46 MPs who would need to sign a motion calling for a Conservative leadership vote under party rules.

But he added: ‘Cameron would win. But it would be very damaging.’

Last night a former Tory Cabinet minister said it seemed ‘implausible’ that there would be a ballot so close to an election. ‘I don’t know where the 46 would come from,’ he said.

And a party source said everyone was ‘focused on fighting hard to win Rochester and Strood’.