Eurosceptics were relishing the prospect of a minority Miliband government and the inevitable resignation of David Cameron. Whoever succeeded him as Conservative leader could only have won by hardening the anti-EU line and then relentlessly harrying what they expected to be a weak Miliband government for its pro-Europeanism. Euroscepticism would reach new and impassioned heights.

All of that is stone dead. One of the silver linings from the election result is the death of Brexit. There will be alarms along the way to the referendum, but the Tory high command has taken the decision that, come what may, Britain must stay in and it is politically skilled enough to ride the political white surf and deliver the necessary yes result.

Mr Cameron’s private view, echoed by George Osborne, has always been that it is of existential importance that Britain remain in the EU. This explains why both Douglas Carswell and Mark Reckless last autumn correctly doubted their leader’s Eurosceptic credentials and left the Conservative party to join Ukip.

The task of Cameron and Osborne was to hold the party together up to the election, throw some red meat to the Eurosceptics by offering to repeal the Human Rights Act, even to the point of withdrawing from the European Convention on Human Rights and have a meaningful, if limited, negotiation that did not involve treaty change that other EU member states would resist. They could then throw the Tory machine – backed by the opposition parties, business and the City, inward investors, unions, agriculture, the arts, universities, Scotland, Wales and Northern Ireland – into winning the referendum. As they know from the government’s own “balance of competences” study, which identified no losers and only winners from membership, the yes case is overwhelming. They could even recruit one or two Tory newspapers to the cause.

All is unfolding to plan, with the icing on the cake the open dissent in Ukip over Nigel Farage’s flawed leadership. The foreign secretary, Philip Hammond, who once declared that he wanted to light a fire under the EU, told the FT that he now aimed to support the yes campaign – joining Cameron and Osborne. Importantly, he publicly clarified what has been obvious for some time: the government does not want to take negotiations so far as to necessitate any treaty change. Britain will not challenge the EU’s core freedoms or the body of acquired EU law. The deal that will satisfy it is a protocol not to commit the country to ever closer union, protections for the City outside the eurozone, as tough an agreement as it can get to control migration, centring on at least a two-year wait to be eligible for benefits, and a commitment to open up EU markets and the accountability of EU institutions.

If the by-product of the British referendum is extending the single market to services – a vital national interest that has been stalled for 20 years – and cleaning up the EU’s murky financial procedures so the Court of Auditors can sign off EU accounts, unintentionally Britain will have done the EU a great service. Expect the margin of victory to be very substantial, settling the issue for a generation and paradoxically driving European integration and prosperity forward.

There is another silver lining. All this is only politically possible within the British right because of the commitment to repeal the Human Rights Act, exit the ECHR and replace it with a UK Bill of Rights. This is where high command has decided to have its necessary struggle with dastardly foreigners, which it judges less damaging than Brexit, but vital to assuage the rightwing appetite for European blood and to assert parliamentary sovereignty – code for uninhibited Tory power unchallenged by “foreign” courts. The trouble is that, while writing a UK Bill of Rights to replace our international legal commitments seems easy at first sight, it opens up a constitutional, political and philosophical quagmire into which the government can only sink.

In the first place, there is no legal or national interest in leaving: the position is driven solely by prejudice and low politics. As Lord Bingham challenged, which internationally agreed human right does Britain want to drop? Second, the arguments against the European Court are bogus. It is an international, not a “foreign”, court, and a British judge sits on all British cases. Critics can identify one ruling – to allow prisoners to vote – as “silly”; even if you agree, to withdraw is a sledgehammer to crack a nut. Is Britain prepared to threaten the legitimacy and standing of a court that entrenches human liberties across Europe?

Then there is the little matter that Scotland, Wales and Northern Ireland are within their legal rights under the devolved settlements to remain in the ECHR, a right they will undoubtedly exercise. In England, human rights will in effect be whatever the party controlling the Commons says they are, as in any one-party state unconstrained by the rule of law, while citizens in Scotland, Wales and Northern Ireland will try to remain part of the European system. The constitutional and legal positions are lethally unstable. The government is also planning to deny Scottish MPs full voting rights in the Commons, inciting Scotland to leave the union. The Lords will vote against withdrawal and, in the Commons, enough good Tories will want to hold the country together to abstain. A parliamentary vote is unwinnable. Britain will not leave the ECHR.

But the divisive, toxic argument will expose the fact that Britain cannot carry on being governed as a de facto Tory imperium. Scotland is in open revolt and swaths of the English electorate are disillusioned. In the north, the “take us with you, Scotland” movement-cum-wheeze is snowballing: 72% in one online poll in Manchester want to join Scotland and leave the UK. Officials in the Cabinet Office were planning for a constitutional convention had there been a hung parliament. It is now obvious that the system is dysfunctional, from the first-past-the-post voting system to human rights, from the powers of cities and regions to the determination of constituency boundaries, from party funding to local taxation.

But the Tory party wants to reserve those decisions for itself, as Labour did when it was enjoying the complete control of the state that the British system confers. There will not be a constitutional convention yet, but the march of events that the Tories are unleashing will force one. A key law of economics is that what is unsustainable cannot be sustained. It also applies to politics – and that is the biggest silver lining of them all.