Let’s not understate the import of what Ireland has just achieved. It has not just secured an outcome that minimises the damage of Brexit on this island. It has radically altered the trajectory of Brexit itself, pushing that crazy careering vehicle away from its path towards the cliff edge.

This saga has taken many strange turns, but this is the strangest of all: after one of the most fraught fortnights in the recent history of Anglo-Irish relations, Ireland has just done Britain a favour of historic dimensions. It has saved it from the madness of a hard Brexit. There is a great irony here: the problem that the Brexiteers most relentlessly ignored has come to determine the entire shape of their project. By standing firm against their attempts to bully, cajole and blame it, Ireland has shifted Brexit towards a soft outcome. It is now far more likely that Britain will stay in the customs union and the single market. It is also more likely that Brexit will not in fact happen.

To adapt Henry Ford, Britain can have any Brexit it likes, so long as it is green

Essentially what this extraordinary deal does is to reverse engineer Brexit as a whole from one single component - the need to avoid a hard Irish border. It follows the Sherlock Holmes principle: eliminate the impossible and whatever remains, however improbable, must be the solution. The Irish Government, by taking a firm stance and retaining the rock solid support of the rest of the EU, made the hard border the defining impossibility. Working back from that, the Brexit project now has to embrace what seemed, even last Monday, highly improbable: the necessity, at a minimum, for the entire UK to mirror the rules of the customs union and the single market after it leaves the EU. And this in turn raises the biggest question of all: if the UK is going to mirror the customs union and the single market, why go to the considerable bother of leaving the EU in the first place?

The great surprise of the text of the joint report is that its language is actually much more favourable to Ireland that the text that was leaked on Monday as having been agreed. The language that caused the Democratic Unionist Party to threaten hellfire and damnation suggested that there would be continuing “regulatory alignment” between the two parts of Ireland. What we’ve actually ended up with is much firmer and clearer - and it explicitly invokes the customs union and the single market as the source of these regulations: “In the absence of agreed solutions, the United Kingdom will maintain full alignment with those rules of the internal market and the customs union which, now or in the future, support North-South co-operation, the all-island economy and the protection of the 1998 Agreement.”

The phrase “in the future” is crucial - it means that every single change in the EU’s rules will have to be mirrored north of the border. But this is now the wooden horse inside the walls of Troy because, to avoid the idea of Northern Ireland becoming a separate regulatory space, there will also have to be the same mirroring of the rules and regulations that continue to apply in Northern Ireland by the UK as a whole. The mathematics are simple: if A equals B and B equals C, then C equals A. A is Ireland’s position in the single market and customs union, B is Northern Ireland’s full alignment to that position and C is the UK’s commitment not to differ from Northern Ireland. The commitment to have no barriers to east-west trade means that London is effectively a prisoner of Belfast.

I suggested earlier this week that we were seeing things being turned upside down: instead of, as DUP leader Arlene Foster insisted, Northern Ireland leaving the EU on the same terms as the UK, the UK will have to leave the EU on the same terms as Northern Ireland. This, in effect, is what is now agreed. We always knew the Border is extremely porous, but what has now been smuggled across it is a minimum condition for the second phase of the Brexit talks: whatever trade arrangements eventually emerge, they cannot be ones in which Britain strays much beyond the existing customs and market arrangements. To adapt Henry Ford, Britain can have any Brexit it likes, so long as it is green.

Apart from all of its other consequences, this means the DUP’s great bluff has been called. It was insisting on two contradictory things: no special status for Northern Ireland and completely leaving the customs union and single market. This contradiction has come back to haunt the whole Brexit project -the DUP has been forced to concede that if the first condition is to be satisfied, the second in effect cannot. The deal secured by Ireland does not necessarily force the UK to stay in the customs union and single market. It just forces it to act as if it has stayed in - a distinction without a difference. Call it what you like - if it acts like a customs union, moves like a customs union and is fully aligned like a customs union, it is a customs union.

But this, of course, is precisely why this deal is not just the beginning of the end of the Brexit talks. It is potentially the beginning of the end of Brexit itself. If the deal sticks, the dreams of a clean break, of throwing off the shackles of EU regulation and sailing off into the great blue yonder of Empire 2.0 are over - unless the “swivel-eyed loons” can stage a coup, call off the talks process and crash out with no deal.

And as they themselves have always argued, if Britain is not making a clean break, what is the point of breaking up with the EU at all? Ireland has just pointed its neighbour towards one obvious answer to that question.