DAVID Cameron could “rip” Scotland out of the European Union against its wishes, the SNP has warned.

It came as Germany’s Angela Merkel stymied the Prime Minister’s attempt to slap a four-year ban on migrants receiving in-work benefits ahead of today’s key Brussels summit.

Hours before the last Prime Minister’s Questions of the year, Sir John Major, whose own party leadership was undermined by bitter internal rows over Europe, said “flirting with leaving” the EU was very dangerous and against the UK’s long-term interests.

He also stressed that so-called Brexit would mean a “high probability that Scotland would have another referendum and leave the United Kingdom”; this, argued the former PM, would leave the UK fractured and damaged.

Sir John’s words were picked up at PMQs by Angus Robertson, the SNP leader at Westminster, who asked Mr Cameron if he would take the advice of one of his predecessors and stop “flirting” with Brexit.

The Prime Minister replied: “What I will be doing is getting the best deal for Britain; that is what we should be doing.

“This Government was the first to cut the EU budget, the first to veto a treaty, the first to bring back substantial powers to Britain. We have a great record on Europe and we will get a good deal for the British people.”

Noting how a poll this week showed there was a strong majority in Scotland for staying in the EU – 46 per cent to 33 compared to 40/40 across the UK – Mr Robertson said Mr Cameron had failed to give any guarantees that Scotland would not be forced out of the EU by the rest of the UK.

“Does he have any idea of the consequences of taking Scotland out of the EU against the wishes of voters in Scotland?” asked the Moray MP.

The Tory leader, to cheers from his own side, declared: “This is a United Kingdom and this is a United Kingdom issue. Why is the right honourable gentleman so frightened of listening to the people and holding this historic referendum, passed through both Houses of Parliament in the past week? I say get a good deal for Britain and then trust the people.”

But later the SNP leader at Westminster added: “David Cameron said he would be heartbroken if the people of Scotland voted to become independent and begged Scots not to vote Yes. Yet we now have the very real possibility that Scotland might be ripped out of the EU against the wishes of the Scottish people, which flies in the face of the everything Scots heard from the No side during the Scottish Independence campaign."

Elsewhere, his colleague Alex Salmond, the former First Minister and now the SNP’s foreign affairs spokesman, said Brexit would "certainly" amount to the kind of "change in material circumstances", which Nicola Sturgeon had suggested could provide the trigger for a second independence referendum.

Tonight from 7pm Mr Cameron will sit down with his 27 EU counterparts to have his first substantive political discussion focused entirely on his reform agenda over dinner.

UK Government sources described it as “an important moment”, noting how since the General Election in May there had been more than 100 meetings with EU counterparts involving the PM, Chancellor George Osborne and Foreign Secretary Philip Hammond.

While they insisted Mr Cameron “remains confident” he could get a deal on all four of his key aims, the most crucial – the proposal for a four-year ban on in-work benefits for EU migrants to Britain – was proving the most difficult.

Indeed, having been cold-shouldered on the issue recently in central Europe, the PM has received a potential fatal blow for his reforms after Mrs Merkel said, that while Germany wanted Britain to stay in the EU, she stressed: “We don't want to and we won't call into question the core principles of European integration. These include, in particular, the principle of free movement and the principle of non-discrimination between European citizens."

Meantime, Labour leader Jeremy Corbyn will also be in Brussels tonight for a private meeting with colleagues from the European Parliament’s socialist grouping, including Francois Hollande, the French President.