It’s been another turbulent week in the Brexit negotiations, culminating in the DUP throwing down the gauntlet over Northern Ireland’s future, and yet another minister resigning from Theresa May’s government.

Yet, according to a number of sources, the negotiators themselves are closer than they have ever been to reaching agreement.

"At negotiator level a deal feels marginally more than less likely," says one source close to the talks.

"The question is, can Theresa May get that through at home. Everything works back from the calculations in London."

The dramatic events of yesterday, and the leaked May letter to the DUP could not have highlighted that fact more starkly.

But even as the negotiators get close, the issues holding things up are as fraught as ever.

What kind of backstop will be agreed?  Will it be time-limited? What kind of control will the UK have over its termination? What are the true implications of the UK-wide customs arrangement now Theresa May’s key vehicle for clinching a deal?

On Sunday 21 October Irish officials watched with some alarm as the Brexit Secretary Dominic Raab went on the Andrew Marr show and talked about a time limit to the backstop.

"It would be rather odd if we ended up in that bridge in a temporary mechanism without a route out," he told the BBC presenter.

"So, it could be time-limted. There could be another mechanism. There needs to be something which allows us to control how long we’re there for to avoid any sense that we’re left indefinitely in a sort of customs union limbo."

Mr Raab had already floated the notion in a Sunday Telegraph op-ed. "We must have finality to any backstop," he wrote, "whether through a time-limit or a mechanism that enables the UK to leave."

Officials in Dublin regarded this as a clear row-back from commitments Theresa May had made to Taoiseach Leo Varadkar when they met on the margins of the 17 October summit in Brussels.

Following contacts with London they were reassured that Britain’s position had not changed. But they remained to be convinced.

Tánaiste Simon Coveney was due to honour a long-scheduled commitment to meet the French foreign minister Jean-Yves Le Drian and the Europe minister Nathalie Loiseau in Paris on Wednesday 31 October.

Mr Coveney had only met the Brexit Secretary once.

Why not invite him to the Irish Embassy in London so the pair could meet either for dinner (or breakfast) while the Tánaiste was en route to Paris?

Mr Raab immediately accepted a dinner invitation.

On the night of Tuesday 30 October, Dominic Raab and a senior DExEU official arrived at the embassy on Grosvenor Place next to London’s Green Park.

They were joined for dinner in an upstairs dining room by Simon Coveney and Adrian O’Neill, the Irish Ambassador.

The meal lasted 90 minutes and was friendly.  

Much of it was taken up by the situation in Northern Ireland.

"You wouldn’t fault Raab on his understanding of the issues," says one source briefed on the dinner. "This was a mature and able conversation."

However, the Brexit Secretary also raised again the issue of a unilateral exit from the backstop. He suggested the UK could terminate the backstop with three months notice.

Mr Coveney slapped it down immediately.

A unilateral exit was out of the question. The issue went no further.

No statement was issued that Mr Raab had been at the Irish Embassy or that a dinner had taken place.

The next day in Paris, the Tánaiste reiterated that London had to make the next move on the backstop and it would have to come quickly.

The feeling in Dublin was that mixed signals about an exit mechanism were holding up a deal.

However, there were contrasting signs coming from David Lidington, Theresa May’s de facto deputy, and part of her inner circle on Brexit.  

Mr Lidington and Mr Coveney have enjoyed a solid rapport since last December.

They spoke four times by phone the week before last, and on Friday 2 November, three days after the embassy dinner, met in Dublin for the British Irish Intergovernmnental Conference.

Mr Lidington talked about respecting all aspects of last December’s Joint Report. Irish officials felt he was restoring faith in the British position after the Raab wobble.

But within two days, confusion was sown once again.

The Sunday Times, citing a dozen British and EU officials, splashed the headline that Sunday: "Revealed: Theresa May’s Secret Brexit deal. Breakthrough on Irish border as PM woos Tory rebels,"

Mrs May had secured "private concessions from Brussels" that would see a UK-wide customs union, the paper said, which would avoid the need for a hard border in Northern Ireland and mean the backstop would never be required.

The EU had also made "a major concession on the Irish border."

Brussels "now accepts that regulatory checks on goods can take place ‘in the market’ by British officials, meaning they can be conducted at factories and shops rather than at the border."

There would be an "exit clause" to convince Eurosceptics the UK would not be in the temporary customs arrangement forever. 

A Whitehall official told the paper: "The PM will be able to say there’s no more backstop, we’ve got rid of that — success. It is UK-wide — success. There’s an exit mechanism — success. The small print is that Ireland is f*****."

Irish and EU officials were flabbergasted.

One diplomat told RTÉ News: "What I see are test balloons going up over the Thames to see how they will land, what can work what cannot work. We’re once again in that kind of phase.

"I’m urging my colleagues in the capital to stay calm and see what is happening.  This is the more nervous part of the negotiations. It would be very premature to say a deal is near - or anything close to it."

An Irish Times front page story on Monday morning, quoting a Dublin source, reported that there would be one backstop, ie the UK-wide customs arrangement, with specific "add-ons" for Northern Ireland that would take account of the need for regulatory checks on goods coming from Great Britain.

The report implied that the Northern Ireland-specific backstop, hitherto seen as an essential safety net if the UK-wide customs arrangement did not work, would fall away.

This was dismissed by a senior Irish figure.

"There’s no question of subordinating or dissolving the Northern Ireland-specific backstop.

"As far as Northern Ireland is concerned, and the backstop for the land border on the island of Ireland, it must be legally operable, and it must apply unless and until [something better comes along]. There’s absolutely no change in our position, there’s no change in the EU’s position."

Part of the apparent confusion is that EU and UK negotiators continue to operate in secretive conditions, the so-called "tunnel".

Within the tunnel various options are being thrashed out, pending the right political alchemy for a deal to emerge.

But the alchemy was not yet right.

Michel Barnier’s Article 50 Task Force had hoped to receive papers from London the previous week, but Downing Street was still mulling over the legal complexities of their preferred option, the UK-wide temporary customs arrangement.

However, in September and October the EU had definitely moved on the idea.

First proposed by London in June, the Temporary Customs Arrangement (TCA) was initially dismissed by Mr Barnier as unworkable, not least because it was a future relationship issue that had no place being in the divorce treaty.

But now the Task Force was willing to accept some iteration of the TCA in the Withdrawal Agreement.

There were suggestions it would be a non-binding reference in the preamble to the Irish Protocol.

Then the draft was re-arranged to place the UK-wide customs idea front and centre as a commitment in a specific legally-binding article, with existing references to Northern Ireland remaining in the EU’s customs territory removed (although the text still implied a Northern Ireland-specific backstop including the application of the EU’s customs code).

Then the Financial Times reported that the basic outline of a customs union itself would be stitched into the Withdrawal Agreement.

This was confirmed to RTÉ News by an EU official close to the negotiations.

"That idea of a bare bones customs union was reasonably correct. It basically covers the whole of the UK, but then you have to bolt Northern Ireland aspects on to that."

But what was happening with the backstop? Would there be one backstop in the shape of a UK-wide customs arrangement?  Or would there be two, with the latter as a first layer, underpinned by a second layer, the Northern Ireland-specific backstop?

Or would it be a combination of both?

Even officials who have been close to the negotiations were unsure.  

"It’s not clear if there will be two separate constructions and they overlap, or if it will be a single construction and it just has a bit that goes deeper for Northern Ireland," said one official. "But in essence that’s the direction of travel,"

Negotiators have also been grappling with the idea of a review clause. But what was being reviewed would depend on which formulation of the backstop was going to be adopted.

The entire backstop idea in itself implies ongoing monitoring.

Paragraph 49 of the Joint Report says that "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."

Determining if those "other solutions", ie a future free trade agreement and/or technology, will or will not work will require some kind of review.

Article 15 of the draft Irish Protocol spells out that if something better does come along "after the entry into force of the Withdrawal Agreement, [the] Protocol shall not apply or shall cease to apply… from the date of application of such subsequent agreement."

Either way, the backstop process looks like it will be subject to review on an ongoing basis.

But if the UK is seeking a termination clause, then that will influence what kind of backstop is ultimately adopted.

"Basically, the more flexibility you have to terminate," says one source, "or terminate on your own terms, the stronger the necessity of having a Northern Ireland-only backstop that kicks in that event. You can’t have both.

"You can’t have a termination on the UK-wide customs arrangement, and then not have the Northern Ireland-specific backstop as a fall back."

In many ways, all the different elements hang together to a greater or lesser extent.  It is a complex interplay.

The elements are: a customs union involving all of the UK, regulatory alignment specifically for Northern Ireland (because a customs union will only deal with 35% of border checks), a Northern Ireland-specific backstop for customs and the single market, a review, termination or arbitration clause, and the future free trade agreement.

But the pre-eminent aspect under discussion is the UK-wide customs idea, what London wants as a replacement for the original backstop.  

The deeper the UK implicates itself in such a structure, the less likely it is that a Northern Ireland-specific backstop will be needed.

"The sequencing here," says a senior Irish source, "is to keep the UK-wide customs union and take that as far as you can.

"Then see, first of all, can we reach agreement on that and can it actually work? And then the question becomes: how much more is needed in terms of regulatory alignment [for Northern Ireland].

"But you’re also likely to need some more customs rules for Northern Ireland, and the question becomes: how much of those extra rules will you need, depending on what’s agreed in the first part."

Brussels is fully aware of London’s red lines: wanting to be able to exit the backstop, and not being "trapped" in a customs union that would constrain the UK’s global trading ambitions, and not having its customs territory split.

However, it is worth remembering that the temporary customs union in which Brexiteers fear being trapped is entirely London’s own invention.

It may be a case of be-careful-what-you-ask-for.

There are growing signs that the small print that the TCA comes with is as much of a problem for Theresa May as any question of time limits and exit mechanisms.

"They have tied themselves up in knots on this issue," a senior EU official told RTÉ News this week, "and they have to unknot themselves. And they expect the EU to help them."

The problem is that if the EU grants the UK a "bare bones" customs union, even a temporary one, it does not want to do so for free.

Under this arrangement, the UK would be granted tariff- and quota-free access to the single market.

In return, the EU will want to ensure that British companies cannot undercut European companies operating in the single market.

These so-called "level playing field" issues cover environmental, social, competition, state aid, health and safety protections that the UK would not normally be obliged to follow because it is leaving the single market.

There will also be a demand that EU fishing fleets continue to have access to UK waters, enraging Brexiteers.

"It implies alignment," says the official, "and then effectively you’re in the single market.  

"Despite all the red lines she had in the past, they now want to be in the customs union. The hold-up is because the British can’t decide what they want in terms of a UK-wide customs arrangement, and the regulatory alignment that would largely replicate what is being proposed for Northern Ireland."

This is why a breakthrough keeps getting held up.

As Theresa May’s cabinet start to realise that the temporary customs idea comes with single market strings attached, the more they want an escape hatch.

According to the London Times, the Transport Secretary Chris Grayling complained to Theresa May that this "would mean a single market through the back door."

By the same token, the more member states are appraised of what this temporary customs union idea actually involves, the tougher line they are taking on its legal nature and the safeguards they believe will be required.

"The more difficult the cabinet believes the final landing zone on the customs union is," says one source familiar with the negotiations, "the more that puts pressure back on the review.  

So it is interlinked.

"In terms of nitty gritty, with the customs union there’s so much detail that has to be hammered through. That where it’s more fraught.

"If that gets resolved we can probably close out on a review clause, but at the moment there are still significant gaps in play between the two sides."

In other words, until the temporary customs union is fully understood by the cabinet and made legally watertight by the Task Force, the more the other key issues such as the review, whether there is one backstop, or two backstops, or a hybrid backstop, will be left up in the air.

At a meeting in Brussels last night, Michel Barnier’s deputy Sabine Weyand briefed EU ambassadors that the negotiations were deadlocked, and faced significant obstacles.

She described three scenarios to address the Irish question that could be considered as the UK reached the end of its two year transition period, beginning at the end of March next year.

According to the Financial Times, these would include a separate agreement on Northern Ireland to replace the backstop, either the full future trade agreement or separate arrangements for Northern Ireland.

A second option would be an extension of the transition period beyond December 2020, the terms of which would be agreed by a joint committee.

A third option would be the Northern Ireland specific backstop, keeping the North within the single market and customs union, with the rest of the UK remaining in a customs union - esstentially the hybrid model as described above.

In the meantime, the EU and Ireland are trying to give Theresa May as much room as possible.  

At the EPP congress in Helsinki, neither Michel Barnier, Jean-Claude Juncker nor Donald Tusk made any exhortations on the Brexit issue.

Leo Varadkar was asked by reporters about the state of play, but largely repeated existing positions.

It is also understood that throughout this week, a directive went down that no Irish minister, TD, senator or MEP was to appear in the British media to pronounce on Brexit.

Then on Friday came Theresa May’s letter, designed to reassure Arlene Foster and Nigel Dodds of the DUP but which appeared to do the exact opposite.

The five page letter was dense, and at times difficult to follow.  

But overall it was an attempt to convince the DUP that there would be no customs border on the Irish Sea, and at the same time to send the shiver of a signal that the party may have to swallow more alignment between Northern Ireland and the Republic than exists at present, in order to avoid a hard border.

In the event, she upset both the DUP, who were publicly angry, and the Irish government, which raised private eyebrows.

Essentially, May had front-loaded her reassurances.

The EU wanted "a backstop to the backstop," she wrote, using the somewhat disparaging form of words for the original Northern Ireland-specific backstop.

However, she "could not accept there being any circumstances or conditions in which [the Northern Ireland-specific]..., which would break up the UK’s customs territory, could come into force."

She then attempted to use the EU’s own legal argument about Article 50 in order say the backstop could only be temporary.

"This is inherent in the Article 50 legal base on which the Withdrawal Agreement will be founded," she wrote, "which cannot aim to establish a permanent relationship."

There is an irony here that will not be lost on EU diplomats.

Brussels had argued from the start (see above) that Article 50 was the wrong legal base for the Temporary Customs Arrangement.

London had brow-beaten Brussels into bending the rules to accommodate their own preferred backstop in the Article 50 treaty, but was now lecturing the EU that the same treaty should not be used for anything that was not temporary.

Mrs May then warned against the backstop becoming a legal mechanism that might be "resurrected" once the future trade relationship was in place.

She "fully" understood the DUP’s concerns in this regard.

She went on to say that "when our future [free trade] deal - which of course will avoid a hard border - comes into force, the backstop must be legally superseded by that future relationship."

That part is true, and Article 15 of the draft Withdrawal Spells that out.

But whereas that article - and the Joint Report of last December - are highly conditional, Theresa May was saying with resolute confidence that the future trade deal would "of course" avoid a hard border.

However, the Joint Report strongly implies that the future trade relationship might not do the job of avoiding a hard border, and in those circumstances the Northern Ireland-specific backstop would have to apply.

Meanwhile, having showered the DUP in reassurance, Mrs May went on to admit that "the unique circumstances of NI could require specific alignment solutions in some scenarios, provided they are consistent with the constitutional and economic integrity of the UK,"

Here she mentioned the Single Electricity Market, and all island animal and plant health, which have required distinct arrangements for Northern Ireland compared to the rest of the UK.

Without spelling out if Brexit would require any new regulatory differential between Northern Ireland and GB, Mrs May left a delicate thread of a hint that there would be.

But if there was it would "clearly be essential that the scope of any alignment in a backstop scenario is carefully circumscribed to what is ‘strictly necessary’ to avoid any hard border."

The DUP looked and the letter and could only see the threat, and not the reassurance.

Despite the prime minister performing cartwheels to say there could not be a Northern Ireland-specific backstop, Arlene Foster tweeted that the letter "raises alarm bells for those who value the integrity of our precious union & for those who want a proper Brexit for the whole UK.

"From her letter, it appears the PM is wedded to the idea of a border down the Irish Sea with NI in the EU SM [single market] regulatory regime."

The DUP’s Sammy Wilson told the BBC’s Today Programme that the letter made it "quite clear the government has accepted there will be a Northern Ireland-only backstop.

"That, to us, is a breach of the promise which has been made that we would not be cut off from the rest of the United Kingdom."

Mr Wilson later told Sky News his party would vote down any Withdrawal Agreement reached on those terms.

Rumours are flying about who leaked the DUP letter and why.

But it is clear that it coincides with manoeuvres by the hardline European Research Group to pull down any Withdrawal Agreement in the House of Commons.

The resignation of Jo Johnson on Friday could prompt others to follow.

If Dominic Raab was to resign - which is a possibility - then Theresa May’s carefully wrought strategy could be in tatters, even if her negotiators emerge triumphant from the tunnel.