On Wednesday 8 November, Taoiseach Leo Varadkar startled the Dáil by saying a breakthrough at the EU summit in December was "likely", allowing the Brexit negotiations to move to the future trading arrangements between the UK and the EU.

His comments were picked up far and wide, not least because of the importance of Ireland in the first phase of the negotiations.

Yet they went against the grain of the prevailing belief that a breakthrough was very much in the balance, at best, or at worst, looking increasingly unlikely.

At the same time as the Taoiseach was briefing the Dáil, a paper was being circulated among EU ambassadors in Brussels in which was embedded an explosive suggestion that would raise the stakes on Brexit and Ireland to hitherto unseen heights.

The paper had been carefully choreographed between the Irish Government and the EU Brexit Task Force, led by the chief negotiator Michel Barnier. So Leo Varakdar was well aware of its contents and importance when he spoke.

The following day, Thursday 9 November, the paper was presented to officials of the 27 member states who were gathering in a regular Brexit Working Group formation in Brussels.

The paper was then leaked to RTÉ News, as well as the Daily Telegraph and the Financial Times. It said that the only way to avoid a hard border in Ireland was, essentially, for Northern Ireland to remain inside, or as close as possible to, the customs union and single market.

Such a scenario would require checks at Belfast and Larne ports and at Northern airports. The border would move off the island and into the Irish Sea.

This was dynamite. It prompted an immediate denunciation from the DUP and the British government. In the news conference that concluded two days of negotiations in Brussels, Britain’s Brexit secretary David Davis said there had been "frank discussions" with Michel Barnier on the Irish issue.

"We recognise the need for specific solutions for the unique circumstances of Northern Ireland," Mr Davis said.

But it cannot amount to creating a new border inside the UK

There were howls of outrage from the Tory press amid claims the Irish had "blindsided" British negotiators.

In the Daily Telegraph, Ruth Dudley-Edwards accused Ireland wanting to "exploit Britain’s difficulties by blocking access to the second stage of negotiation" in order to "exert maximum leverage" by demanding something unionists would reject as a staging post to a united Ireland.

The Sun quoted unnamed Conservative ministers who whispered that "Sinn Féin/IRA" had leaned on Varadkar to ambush the UK.

The Minister for Foreign Affairs Simon Coveney denounced The Sun story as completely untrue. But the Task Force paper was an undoubted upping of the ante by Dublin.

Tougher language, in contrast to the Taoiseach’s sunny outlook in the Dáil, accompanied the paper. At the Fine Gael national conference in Cavan, Coveney warned that Ireland "will not be ignored" in the Brexit negotiations.

The Task Force paper raised eyebrows in Brussels as well.

"I was completely taken by surprise," one senior EU official, closely associated with the Brexit process, told RTÉ News.

It’s high risk stuff. It was trundling along in a somewhat boring way, now suddenly we’re up there with the highest possible stakes

Within the European Council, the body representing heads of government, officials handling the Irish issue were also taken aback.

"The response," according to one source, "was: really? Seriously? You’re bringing something out now?"

However, surprise was not the same as concern. The paper did not cause waves among the EU member states. The text suggesting Northern Ireland remain in, or close to, the customs union and single market, was presented as an EU Task Force working paper – but there was no doubt it was there to transmit a signal to London.

"There was an understanding that this was an internal document," says a well-placed EU source. "But it was mainly for outside consumption. It was a document that was designed to be leaked."

What was going on?

Discussions with several well-placed Irish and European sources reveal a carefully co-ordinated escalation by Ireland and the Task Force to put pressure on the UK to get to grips with the Irish border issue.

The pathway to this escalation, according to senior Irish sources, has been clear all the time, clear to everyone – they say – but the British.

"All we have been getting from the British," says one source, "was muzak, and nothing else."

What had Britain offered so far on the Irish border?

On 14 August, London published a 27-page negotiating paper on Ireland.

It said Britain would "not accept" a hard border.

The paper talked about a new, undefined customs "arrangement" between the UK and the EU; there could be a so-called trusted trader scheme so that big companies could be fast-tracked through customs clearance; SMEs with goods crossing the border could be exempted from customs declarations; there could be some all-island agrifood arrangements based on the fact that Ireland was already deemed a "epidemiological" unit where animal diseases were concerned.

The paper was swiftly and brutally dismissed by senior EU Task Force negotiators as "magical thinking". Michel Barnier accused London of wanting to undermine the legal order of the EU’s customs union and the single market.

Essentially, Dublin and Brussels believed that Britain was half-heartedly focussing on technical fixes around trade and customs. The Irish question was not just about economics, it was about the abstract strengths of the Good Friday Agreement, about peace and reconciliation and societal progress.

"Border issues are broader than economic questions," said the EU’s formal response to the British paper, the so-called Guiding Principles document published on 6 September.

"The physical border itself was a symbol of division and conflict."

Contained within these principles was a subtle tightening of the screw by both the Irish Government and the Barnier Task Force. That tightening would continue.

On 15 October, at the end of the EU summit in Brussels, the EU27 declared that while there had been some progress on protecting the Good Friday Agreement, Michel Barnier would provide "further refinement" of the six Guiding Principles on Ireland.

The "further refinement" would relate to the "avoidance of a hard border." The EU "expected" the UK to present and commit to flexible and imaginative solutions.

RTÉ News understands the language was carefully coordinated between Dublin and Brussels. All 27 EU member states signed up to the statement.

Something else even more subtle was going on behind the scenes.

Throughout the summer, with each round of Brexit negotiations, both Michel Barnier and David Davis spoke of a prolonged "mapping" exercise being coordinated between officials on both the EU and the British side.

The mapping was essentially a detailed examination of all those areas of North-South co-operation, as provided for by the Good Friday Agreement, which were underpinned by mutual EU membership by Ireland and the UK, and which would therefore be adversely affected by Brexit.

On the face of it, North-South co-operation was delineated through the six North-South Implementation Bodies established by the Good Friday Agreement.

There were also "six areas for cooperation and implementation" agreed by the North-South Ministerial Council (NSMC).

The NSMC had also agreed seven priority areas at its last meeting in November 2016.

They included the environment, health, agriculture, transport, education/higher education, tourism, energy, telecommunications, broadcasting, inland fisheries, justice and security, and sport.

All that mapping was highly detailed and technical. In time, officials quantified the level of EU-relevant areas of North-South cooperation. It came to 142 areas.

It was becoming clear that, as they waded through all of 142 areas in detail, officials on both sides were discovering more and more areas of North South activity that was touched by EU law.

The mapping file was getting thicker and thicker.

It also was becoming clear to officials in Brussels – and Dublin – that there were things outside the strict remit of the Good Friday Agreement where Brexit was going to have an adverse impact on daily life.

"The deeper you go," says one EU source familiar with the mapping exercise, "the more examples there are, more areas where you find out that actually a lot of the Good Friday Agreement requirements are more implicit than anything else. They rest on the status quo, and that status quo involves membership of the EU single market."

One example is cross-border health.

Look closely, and you can see where the single market is essential to its functioning.

It requires equality of patient rights, but also things like single standards for medical devices, the approval of medicines at EU level, mutual recognition of medical qualifications, mutual acceptance of cross border ambulance activity.

"All of this is completely aligned at the moment," says the source, "because Ireland and the UK are members of the EU."

In other words, there is a lot more at stake than simply the explicit North South cooperation established by the Good Friday Agreement.

There is really the idea of the island as a single economic area, a single labour market – that’s on top of the Good Friday Agreement

This reality was carefully reflected in the Task Force working paper on Ireland.

"Already prior to undertaking this [mapping] exercise," the paper stated, "the EU's guiding principles underlined that an important part of political, economic, security, societal and agricultural activity on the island of Ireland currently operates on a cross-border basis, underpinned by joint EU membership of the UK and Ireland."

The paper went on: "The EU and the UK have committed to protecting and supporting the continuation and development of this cooperation and of the functioning of the institutions established by the Good Friday Agreement."

The fact that the paper divides the concept into two parts is subtle, but crucial: both the EU and UK were committed to safeguarding this cooperation, and the functioning of the institutions established by the Belfast Agreement.

In other words, there were now two, not one, concepts to look after.

It was further strengthened in the final paragraph of the document.

"It consequently seems essential," the Task Force paper states, "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."

Here, there is even a third notion: an all-island economy.

In other words, taken altogether, in order for the EU and UK to protect the Good Friday Agreement, and meaningful North-South Cooperation, and the all-island economy, there cannot be any "regulatory divergence" from the rules governing the single market and the customs union.

Therefore, to avoid a hard border, both sides of the island would have to maintain the same rules as codified in the EU customs union, and the single market.

One senior EU official has interpreted the text as follows: "No regulatory divergence means the same thing as being in the customs union and the single market.

"A guarantee of no legal divergence means some kind of legal obligation to follow [EU] rules. I just can’t understand it any other way."

All this was being stealthily prepared as Theresa May was grappling with sex scandals and ministerial resignations.

In general, the Irish Government was concerned that, with the December summit fast approaching, there was dangerous drift. Britain was coming up with nothing new on Ireland.

More specifically, Dublin was concerned that the significant progress made on the Common Travel Area, which had been all but agreed by British and EU negotiators, would be "bagged" by London, and then presented as "sufficient progress" in order to move things into Phase II.

Dublin needed something concrete from London. It was two months since the Guiding Principles Paper, and since then the EU26 had had nothing on Ireland to work on – no papers, no drafts.

Ireland therefore had two reasons to up the ante: to keep the pressure on the British, and to provide something tangible for the EU26. "There’s always the importance of avoiding a vacuum," says one Irish source.

There was pressure from other quarters. On 30 October, Ireland’s Commissioner Phil Hogan met arch Brexiteer and UK Environment Secretary Michael Gove at the World Dairy Summit in Belfast.

It’s understood Hogan pressed upon Gove the need for the UK to properly examine the need for Northern Ireland – if not the UK as a whole – to remain in the customs union and single market if Britain was to get serious about avoiding a hard border.

Gove, according to a source, gave little away except to acknowledge Hogan’s argument. Another source said Gove offered a hint that there may be some "all-island" opening on agrifood.

On 6 November, Phil Hogan had a breakfast meeting with James Brokenshire, the Secretary of State for Northern Ireland, at the European Commission headquarters in Brussels, during which Hogan drove home the same arguments he had made to Michael Gove. Again, the indications are that Brokenshire was unimpressed.

That afternoon, Brokenshire delivered a speech to the European Policy Centre (EPC) in Brussels.

He told the audience: "We joined the Common Market in 1973 as one United Kingdom and we will leave the European Union in 2019 as one United Kingdom. And as the Prime Minister has made clear, leaving the EU will mean that we leave both the single market and the customs union."

The text of the speech continued: "I find it difficult to imagine how Northern Ireland could somehow remain in while the rest of the country leaves."

However, going off script, Brokenshire added that he would find it "impossible" to imagine Northern Ireland remaining in the customs union and single market.

Brokenshire repeated aspects of London’s August paper on Ireland, highlighting trusted trader and all-island agrifood and epidemiological options as ways to avoid a hard border. Again, these were met with by scorn by Irish officials as "mantra."

With continuing inflexibility on the British side, and the chaotic sideshow of the Tory civil war on Brexit, Dublin decided to flex its veto.

From the very beginning, the EU had structured the Brexit negotiations in order to nail three key concessions from the UK in the first phase: Britain’s exit bill, the rights of EU citizens in the UK, and the Irish border.

Only if there was "sufficient progress" on these three points could the UK move to Phase II. But then it could be too late for Ireland to use its veto. There was also the risk that the UK could try to use the Irish border issue in Phase II to extract concessions from the EU when negotiating the trade deal.

This is something Dublin worries about, although EU officials say that it the UK tried to use Ireland as a bargaining chip the Phase II negotiations would crash and burn.

"[The Task Force working paper] is not the kind of paper the Commission would have put out without having thoroughly discussed what to put in it with the Irish before," says one EU source.

So there’s an Irish agenda behind it. This is the moment of highest leverage that they have. The lead up to December is when these issues can really be in the limelight

Dublin believes that Britain has only a couple of weeks to produce something meaningful on the Irish border.

But the pushing the process in a more radical direction has its own risks.

Theresa May depends on the DUP for her survival. They are adamant that they see any move towards the North staying within EU structures as weakening the British Union. But if the DUP pull the plug, they could be staring down the barrel of a general election after which Jeremy Corbyn walks into Number 10.

"Unless Theresa May finds depths of courage and imagination," says one senior EU source, "of which she has shown no signs so far, is she going now to do a brave and risky thing, and say to the DUP, listen you guys you’ve got nowhere else to go anyway, so this is what’s going to happen?"

Irish sources closely involved are also incensed that David Davis, the Secretary of State for Exiting the EU, reacted to the Task Force paper by suggesting it undermined the constitution of the UK.

"We never, ever brought into this discussion the constitutional issue," says one source. "That was brought in by David Davis. That’s not where we want to go. There are ways of touching upon this without touching on any constitutional issues.

"It is possible to have a separate customs space within a state, also all island regulatory arrangements are possible too. That’s something we’d need to look at quite carefully, because of the responsibilities and powers than would devolve on [Ireland]. But these are all issues that have to be looked at. The British will have to move. They’ll have to move in substantive terms a reasonable way.

"The Good Friday Agreement in any event completely guarantees the constitutional position of Northern Ireland within the UK. The notion that this is a kind of stalking horse for a creeping United Ireland-ism is nonsense. It requires leadership from the British, and a certain amount of common sense by the DUP."

It is still a calculated gamble by Dublin. Ireland holds an effective veto on Britain progressing to Phase II of the negotiations, the part that starts to look at the future trading relationship. Once we move to Phase II Ireland’s veto disappears.

Britain insists the Irish border can’t be solved until we’re in Phase II, because it necessarily deals with the issues of trade and customs.

But what if London suddenly makes an offer on the financial settlement and on EU citizens’ rights, leaving Ireland as the last issue holding up progress to Phase II?

For now, Dublin is confident that its interests have been subsumed into the EU27’s interests and that Ireland will not be abandoned.

"We’re part of the EU 27, we’re in very strong company in this," says one source. "It’s not necessarily going to come down to little old Ireland pulling the trigger. Under the Treaty, Article 15.4 does say, unless otherwise decided, the European Council takes decisions on the basis of consensus and unanimity. So everybody needs to agree."

This week Downing Street contacted the Department of the Taoiseach to arrange a meeting between Theresa May and the Taoiseach on the margins of the EU Social Summit in Gothenburg.

Ahead of the summit British officials sought to play down the high tensions that had followed the Task Force paper, even disavowing to the Irish counterparts any notion that they had briefed The Sun that Sinn Féin was putting pressure on the Taoiseach to harden the Irish position.

Theresa May and Leo Varadkar met in Gothenburg ahead of the EU Social Summit.

According to sources, there was a frank exchange of views. The Taoiseach emphasised that there had to be a written commitment from the UK on some solution that would avoid regulatory gaps on the island of Ireland.

By contrast, Theresa May suggested that all sides were close on the issue, and were even "on the same page."

A Government source suggested this was wishful thinking; without a guarantee that would be written into the conclusions of the December European Council, London would be asking Ireland to take a leap into the dark.

To repeated British entreaties that the Irish border could only be properly solved in Phase II, Leo Varadkar had a clever riposte. Britain had unilaterally ditched membership of the customs union and single market before Phase II – ie, the trade negotiations – had started.

In that case, he said, they could also pull a hard border off the table before Phase II as well.

When asked if Ireland would exercise its veto at the December summit if Britain hadn’t met Dublin’s demands, the Taoiseach said the EU would exercise a veto.

The alignment of Ireland’s and the EU’s posture on Brexit was now overt, and it was assertive. Donald Tusk, the President of the Council, also warned that Theresa May had two weeks to make up her mind on the Irish border, and on the other two issues.

The December summit is now set for a showdown of historic proportions.