When Theresa May joined Jean-Claude Juncker for lunch on 4 December to agree a deal on the Irish border, EU officials had changed wording on the text back and forth that morning.

At the final moment, the concept of "regulatory alignment" was chosen over "no regulatory divergence" at the request of London.

But what do these similar sounding phrases mean, and why have they gone to the heart of the Irish border dilemma?

The context in which these concepts would apply, negotiators realised, would determine how closely Northern Ireland cleaves to the EU single market and customs union.

Dublin has made no secret that it would prefer the UK to remain in both. It has been expressed by Taoiseach Leo Varadkar and Tánaiste Simon Coveney on numerous occasions.

But the notion of Northern Ireland staying in the customs union and single market on its own, with the rest of the UK leaving, first came to real prominence through an EU Task Force working paper, leaked on November 9.

On that occasion, the option was "no regulatory divergence".

That paper stated: "It… seems essential for the UK to commit to ensuring that a hard border on the island of Ireland is avoided, including by ensuring no emergence of regulatory divergence from those rules of the internal market and the customs union which are (or may be in the future) necessary for meaningful north south cooperation, the all-island economy and the protection of the Good Friday Agreement."

In other words, if you want to avoid a hard border, it would be better if the reasons that require one are removed.

Irish sources suggest the Task Force paper was designed to prod the British side out of a torpor of anemic ideas on Ireland. It certainly prompted an explosive reaction. British officials claimed they had been ambushed.

"We respect the European Union’s desire to protect the legal order of the single market and customs union," David Davis, the Brexit Secretary shot back. "But that cannot come at a cost to the constitutional and economic integrity of the United Kingdom."

There could not be, he said, "a new border inside our United Kingdom".

In the weeks before last Monday’s lunch between Mrs May and Mr Juncker, senior EU officials cautioned that the kind of language that would appear in any final joint paper between the EU and UK, would, therefore, be heavy on principle and light on detail.

"You won’t expect a solution that is detailed," said one senior EU source. "That is impossible."

Even so, the principle of how to avoid a hard border would have to be robust enough for Dublin.

There was a definite sense in Brussels that Ireland had raised the stakes with the Task Force working paper.

But Ireland had been supported to the hilt by Michel Barnier (below), the EU’s chief negotiator.

As officials got down to negotiating in Brussels ahead of last Monday’s meeting, it was clear that Britain, however, was going for a minimalist approach to the question of how to protect the Good Friday Agreement (GFA), and how to avoid a hard border.

Ireland, and the EU Task Force, wanted a maximalist approach.

As this blog has outlined before, the forensic mapping of the GFA by negotiators had unearthed 142 areas of North-South cooperation that would be disrupted by Brexit.

Ireland’s preference was a holistic solution to prevent that disruption, and also to make sure that the gains of the GFA, which - it could be argued - had delivered an all-island economy with increasingly integrated cross border supply chains and so on, were preserved.

Britain, on the other hand, wanted to be highly selective, looking only at those areas that were explicitly covered by the GFA, and not a wider spectrum of activity that was implicitly enabled by both the GFA and mutual EU membership.

"There are two ways of doing it," said one EU official in the run up to last Monday.

"One is that you have multiple, bilateral, sector-by-sector solutions. Or you have a blanket 'you’re staying in the customs union and single market' solution.

"The first [British] option covers only North-South cooperation issues under the GFA. But that doesn’t cover a lot of the things that are going to affect people’s lives massively: the single labour market, a single island economy. That’s bigger. That comes out of the situation that has emerged from the GFA."

The first key point is that, despite London’s outright rejection of "no regulatory divergence", British officials were still content to allow the idea to appear in the joint draft once it took shape on Thursday 30 November.

Over last weekend, as this blog reported yesterday, London’s concerns about the idea deepened.

In fact, right up until just before the lunch, the phrases were being alternated as officials in Brussels, London and Dublin scrapped over the thrust of what it all meant.

The text that was finally agreed (before the DUP pulled the plug) opted for "alignment".

Arlene Foster had said the DUP's red line was a situation where Northern Ireland was

different from the rest of the UK

By Thursday night, a new text had appeared, with fresh language designed to appease the DUP. Despite the DUP’s demands, the concept of regulatory alignment was not removed from the Monday’s text. Dublin would not have allowed it.

Paragraph 49 of the new text reads: "The UK remains committed to North South cooperation and to its guarantee of avoiding a hard border. Any future arrangements must be compatible with these overarching requirements. The United Kingdom's intention is to achieve these objectives through the overall EU-UK relationship."

That is designed to show the world that the UK is serious about its commitments to the North South element of the GFA, and that that commitment must be future-proof.

However, the text also shows that the UK would prefer, first and foremost, that the border problem is solved through a future free trade agreement (FTA) between the UK and EU. If there’s free trade, why have a border, is the logic.

Paragraph 49 continues: "Should this not be possible, the United Kingdom will propose specific solutions to address the unique circumstances of the island of Ireland."

These solutions are not spelled out. But we can assume this relates back to Britain’s paper on Ireland produced in August, where London’s solution to the border was for a range of customs exemptions for "trusted-traders" and SMEs, against a backdrop of "a highly streamlined customs arrangement between the UK and the EU" or "a new customs partnership".

Another "specific solution" suggested is the prospect that London could devolve more powers to Belfast, so that the Northern Ireland Executive could decide which competences could be done on an all-island basis.

The August paper admitted these solutions were "innovative" and "untested".

The last part of Paragraph 49 in Friday’s document is the key one for Dublin: "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 cooperation, the all-island economy and the protection of the 1998 Agreement."

In other words, if the first two options - an FTA and UK-authored solutions - don’t work, then the third is a last resort (or the default, as the Taoiseach referred to it).

So there is a cascading effect. But both the EU Task Force and the Irish Government believe the first two options are not sufficient to avoid any hardening of the Irish border.

One source familiar with the process puts it thus: "It’s a safety net - if we can’t find any magical powder to make the British solution work."

Further language designed to reassure Unionists is found in Paragraph 50.

"In the absence of agreed solutions, as set out in the previous paragraph, the United Kingdom will ensure that no new regulatory barriers develop between Northern Ireland and the rest of the United Kingdom, unless, consistent with the 1998 Agreement, the Northern Ireland Executive and Assembly agree that distinct arrangements are appropriate for Northern Ireland. In all circumstances, the United Kingdom will continue to ensure the same unfettered access for Northern Ireland's businesses to the whole of the United Kingdom internal market."

This paragraph makes it clear that Arlene Foster’s declaration could be met: there will be no border on the Irish Sea, and there will be no regulatory barriers between Northern Ireland and Great Britain.

The text then invites a scenario where the Northern Ireland Executive could, of its own accord, decide to do things differently - or to go for regulatory alignment with the South in terms of EU regulations.

This most likely refers to some kind of all-island agri-food framework. Already, as James Brokenshire, the Northern Ireland Secretary noted when he visited Brussels, the island of Ireland as a whole operates as an epidemiological unit for animal health purposes.

The next line is interesting: "In all circumstances, the United Kingdom will continue to ensure the same unfettered access for Northern Ireland's businesses to the whole of the United Kingdom internal market."

For now, the Irish Government’s interpretation of "alignment" and Britain’s are different and that difference will remain for some time.

The Irish Cabinet sought legal advice on "regulatory alignment". According to one well-placed Irish source, the Government takes succour from the fact that regulatory alignment is the criterion required of countries acceding to the EU.

The key difference there, however, is that a country acceding to the EU is converging with the EU’s regulatory sphere. Through Brexit, the UK wants to diverge.

According to EU sources, London regards "alignment" as much looser, something that is voluntary. Rather than Northern Ireland remaining bound by the EU single market and customs union rules (ie, not diverging from them), this would be a voluntary act by the UK to allow Northern Ireland to align itself with certain rules in certain situations, according to London’s more minimalist interpretation.

In any event, following the collapse of Monday’s deal, the Brexit Secretary David Davis (below) told a startled House of Commons on Tuesday 5 December, that Northern Ireland would not be treated any differently from the rest of the UK, because regulatory alignment was what the whole of the UK aimed for.

"Any regulatory alignment we get as part of a Brexit deal for Northern Ireland," he said, "will apply for the whole country."

This was also a reflex response to the clarion calls in Cardiff, Scotland and even London for those regional entities to remain in the customs union and single market.

However, Eurosceptics want the exact opposite: a move away from the EU’s regulatory sphere so that global Britain can ride a wave of new free trade agreements with far flung countries.

Jacob Rees-Mogg MP said not aligning itself with EU regulatory standards should be an "indelible red line".

Iain Duncan Smith MP, a former Tory leader, told the BBC: "I think the vast majority of the party genuinely would be concerned if we box ourselves into an arrangement where we have no flexibility at all about the way we set our own rules and regulations after we leave the European Union."

The day before Mrs May’s pre-dawn dash to Brussels, Boris Johnson, the Foreign Secretary, told Channel 4 News: "It is very, very important that whatever happens now, whatever we agree, has got to be consistent with taking back control of our laws, of our borders and our cash."

In other words, no regulatory alignment for the UK (or for Northern Ireland, for that matter).

Mr Davis gave his own take in the House of Commons: "Alignment isn’t harmonisation, it isn’t having exactly the same rules, it’s sometimes having mutually recognised rules, mutually recognised inspection, all of that sort of thing as well, and that’s what we’re aiming at."

"Mutual recognition" is not a casual turn of phrase.

To some Brexiteers it’s simple: if there is mutual recognition between the EU and the UK on all goods, then a Free Trade Agreement is straight-forward, and there would be no hard border in Ireland.

One person who has written extensively about this is in his EU Referendum.com blog, is the author Dr Richard North.

Dr North has accused Leavers of misunderstanding "mutual recognition," by "suggesting that regulatory barriers are overcome between the EU and the UK by a beguilingly simple expedient: we recognise the EU's regulatory standards in relation to goods while they recognise ours".

He points out that within the EU, harmonisation is much preferred to mutual recognition.

Harmonisation, as the word suggests, is the purest form of free trade. Everyone in the EU applies the same rules on how goods are produced and marketed, and those rules are obligatory.

But sometimes harmonisation doesn't cover everything.

Mutual recognition, then, is used as a second best. It basically means that if a product has been legally marketed in any one member state, the EU regulation that applies to the goods in the (EU) country of origin must be accepted by the other EU member state to which the goods are exported.

In other words, the receiving member state cannot apply its own local law in order to prevent the export of those goods.

But as Mr North has pointed out, mutual recognition will not apply in a future UK-EU scenario for the simple reason that the UK will no longer be an EU member state.

Even if the UK repatriates the EU regulation in question in the Great Repeal Bill, "it will have no effect on our trade relations with the EU because the principle applies to goods produced in one member state and marketed in another. When we leave the EU, we will no longer be a member state, so the law will not apply to us - unless special provisions are made by the EU".

Mr North points out that in the EU-Canada free trade agreement (known as CETA), there is no blanket mutual recognition principle.

And the EU’s chief negotiator Michel Barnier has repeatedly suggested that a CETA style deal is the best kind of trade deal Britain is likely to get.

Bringing all this back to Friday’s deal, and the notion of "alignment", and it becomes clear that London’s idea of alignment, as articulated by David Davis ("it’s sometimes having mutually recognised rules, mutually recognised inspection, all of that sort of thing as well…"), is different to to the EU’s idea of alignment.

Furthermore, and more worryingly, it is different to Ireland’s idea of alignment, and how and where it is appropriate when preserving North-South cooperation.

This brings us back to the mapping exercise which showed that there were 142 areas of cooperation which are potentially disrupted by Brexit, because these areas (health, education, energy, environment etc) are enhanced by both Ireland and the UK being in the EU, and sharing the same regulations.

Ireland’s view is that the negotiating guidelines demand that the Good Friday Agreement ("in all its parts") be preserved. That is what Britain has been obliged to guarantee in order to get out of Phase I into Phase II.

However, Ireland’s interpretation is that the GFA isn’t just the letter of what the Belfast Agreement says, but what it has achieved. And what it has achieved is, essentially, peace, prosperity and "an all-island economy".

And, in Friday’s text, the UK declared it would: "maintain fully alignment with those rules of the internal market and customs union which, now and in the future, support...the all-island economy."

So, take the 142 areas of North-South activity that is impacted by Brexit, add to it the need to support the all-island economy, then the logic of Ireland wanting a maximalist interpretation of "full alignment" is clear.

However, when Denis Staunton of the Irish Times put the question to the Department of Exiting the European Union (DexEU), he got a very different response.

A spokesman for the department said the commitment to maintain full alignment with the "rules of the internal market and the customs union" applied only to the six areas of North-South economic co-operation identified in the Belfast Agreement.

These are transport, agriculture, education, health, environment and tourism.

Crucially, the official said that 142 cross-border policy areas identified by the Barnier task force were merely "subsets of the original six".

This meant that the UK was still perfectly free to leave the single market and the customs union.

So Britain, according to this reading, has not really deviated from its position before the text was agreed on Friday.

That was best articulated by the former Conservative Party leader William Hague who wrote in the Daily Telegraph that instead of sweeping solutions, the both sides should selectively look at individual areas that are empirically disrupted by Brexit and provide solutions for each one individually.

This would, again, relate back to the Joint Report and Paragraph 50, which states: "The United Kingdom will ensure that no new regulatory barriers develop between Northern Ireland and the rest of the United Kingdom, unless...the Northern Ireland Executive and Assembly agree that distinct arrangements are appropriate for Northern Ireland."

One of the areas that the Conservatives refer to is the Single Electricity Market on the island of Ireland. It has been enhanced by both the GFA and the EU’s single energy market.

That would be a good example, they might say, of allowing the Northern Ireland Executive deciding itself that it wants to align the North with EU rules as a way to avoid a hard border.

There are two big problems with this approach, from an Irish point of view.

One is, that energy flowing from South to North and in the other direction is not really a hard border issue (energy cannot be stopped and have a tariff applied to it at a border checkpoint).

The other is that a selective approach to what is aligned, and what is not aligned, will still require checks at the border.

How else will you know which good is produced under EU regulations and which is not, unless you check?

So, all told, there are a lot of ambiguities and clashing interpretations which hang over Friday’s breakthrough.

The biggest ambiguity of all is the notion of no hard border on the island, and no border on the Irish Sea.

It is only if there is really high alignment on single market and customs unions regulations on all goods and services that you can avoid a hard border.

Unless that high alignment extends to Great Britain as well, it’s hard to see how you could avoid checks at Belfast and Larne Ports.

The bottom line is that the EU will not permit businesses, who do not produce goods to the same standards, at the same costs, abiding by the same rules, as businesses who do have to meet stringent EU standards in other member states, to send their goods from Great Britain into Northern Ireland, where they would then be free to flow across into the Irish Republic and from there to anywhere in the single market.

For now Dublin believes that Friday’s text means that full alignment will extend to Great Britain (because of the east-west language put in to reassure Unionists), and that the trajectory from a hard Brexit will therefore shift to a soft Brexit.

London believes that full alignment is a last resort, and that even then it will only apply selectively in order to satisfy a very strict reading of what North-South cooperation actually means.

As the DexEU spokesman told the Irish Times: "There are a very unique set of circumstances that apply to Ireland that don’t apply to anywhere else in the UK. But in terms of customs union and single market membership, the UK as a whole will be leaving."

Who is right?

Experts will debate that till the cows come home.

Dublin argues, correctly, that the Irish issue will continue to have its own strand in Phase II, and that the weight of the Irish paragraph in the first set of negotiating guidelines will also carry through.

Phase II will set out the agenda for the future trade relationship. It is during that phase, and the actual trade talks themselves which start the moment the UK becomes a third country in March 2019, where the Irish border will once again become a live issue, and where the whole alignment contradiction will have to be sorted out.

The Irish Government points to Paragraph 46 in Friday’s text: "The commitments and principles outlined in this joint report will not pre-determine the outcome of wider discussions on the future relationship between the European Union and the United Kingdom and are, as necessary, specific to the unique circumstances on the island of Ireland. They are made and must be upheld in all circumstances, irrespective of the nature of any future agreement between the European Union and United Kingdom."

In other words, at all times must the guarantee by the UK to avoid a hard border be a non-negotiable, immovable anchor, one which will ultimately prevent the UK from drifting away from the EU’s regulatory orbit, and which will oblige the UK to stick by its promise of alignment - a promise made not just to Dublin, but to Belfast as well.

This, then, is what the Irish Government means by a cast-iron guarantee. At each stage of the Article 50 withdrawal, the EU27 will update their negotiating guidelines, and Ireland will again have an effective veto on what those guidelines say.

So the Government believes it cannot be strong-armed into anything which threatens a border, "now or in the future".

As one source puts it: "Ireland might have been prone to strong arming when, right before the bail-out, the markets were opening and no-one would lend to the country. But they can’t be strong-armed now."