On 26 July 2016, just over a month after the Brexit referendum, Theresa May had lunch with Enda Kenny in Number 10 Downing Street.

In a statement afterwards, Kenny said: "We are in full agreement that we do not wish to see any return to the borders of the past on the island of Ireland."

A senior EU official phoned a British diplomat that afternoon and asked: "If you're leaving the single market and customs union, how are you going to do that?"

"We don't know yet," was the response.

Reconciling a hard Brexit with the promise to avoid a hard border in Ireland has been, and remains, the central dilemma of Britain's tortured departure.

Three years, thousands of meetings, countless statements, numerous commissioned studies and relentless explorations of technicological options later, the question remains unanswered.

In Stockholm on Thursday, Kenny's successor Leo Varadkar said: "I don’t fully understand how we can have Northern Ireland and the Republic of Ireland in a separate customs unions and somehow avoid there being tariffs and checks and customs posts between North and South."

The UK had almost completely ignored the customs issue during and immediately after the referendum.

Throughout the autumn of 2016, Dublin watched anxiously for signs that the UK might remain in the customs union. If they did, it would remove one of the risks of a hardening of the border, and protect €65 billion in annual bilateral trade.

Theresa May's heady party conference speech in October 2016 did not specify customs, but she made it clear: "We have voted to leave the European Union and become a fully-independent, sovereign country."

Irish officials were told by their British counterparts that Mrs May was simply complying with the demands of a party conference.

Three months later the prime minister's Lancaster House speech made little more than a passing reference to Ireland. Mrs May spoke of preserving the Common Travel Area and promised "no return" to the borders of the past.

But her remarks on customs raised eyebrows.

She wanted a "customs agreement" with the EU, but was vague as to what that would be. "Whether that means we must reach a completely new customs agreement, become an associate member of the Customs Union in some way, or remain a signatory to some elements of it, I hold no preconceived position."

Brussels was baffled. Dublin saw a door being left open.

But as the negotiations got under way in June 2017, London argued that the Irish question should be dealt with through the future relationship which would, after all, settle the bilateral trade and customs relationship.

Dublin and Brussels said it had to be agreed in the divorce, otherwise the border would become a bargaining chip during those trade negotiations.

Faced with a December 2017 deadline, Theresa May conceded that if a free trade deal and/or "alternative arrangements" such as technology, trusted trader schemes and so on did not remove the need for a border, then Northern Ireland would effectively remain in the single market and customs union. In other words, the backstop.

By March 2018, a beleaguered Mrs May was trying to frame a closer customs relationship as a win-win.

In a speech to the Mansion House, she said the UK could not have a Canada-style free trade agreement, nor trade on WTO terms, because "this would mean customs and regulatory checks at the [UK-EU] border that would damage the integrated supply chains that our industries depend on and be inconsistent with the commitments that both we and the EU have made in respect of Northern Ireland".

However, she also made it clear that whatever was agreed could not lead to a customs border on the Irish Sea.

This was, in fact, a hint of May's new idea: the UK as a whole staying in the customs union for a temporary period, the so-called "UK-wide backstop".

The circle would be squared. A temporary customs union joining the UK and the EU would mean no tariffs or customs checks on the island of Ireland, or on the Irish Sea - and UK manufacturers would continue to benefit from just-in-time supply chains between Britain and the EU because there would be no customs checks or tariffs or rules-of-origin there either.

As we now know, this approach foundered on Brexiteer fury at Britain's independent trade policy being hamstrung by the UK being potentially stuck in this new arrangement.

And so Theresa May and her UK-wide backstop were cast aside and Boris Johnson took over.

The new prime minister discarded the promises of protecting the all-Ireland economy and North-South cooperation. Essentially Ireland would have to get used to the idea that Brexit meant a customs border. There were, he said repeatedly, "ample" solutions to make it, not frictionless, but as frictionless as possible: technology, exemptions, trusted traders schemes.

This no-nonsense approach made its way into the UK's "non-paper" on customs which pre-figured the formal text.

"The UK is leaving the EU customs union and single market," noted the paper, one of three delivered to the European Commission by Johnson's chief negotiator David Frost on 20 September.

"In this context, this proposal suggests a way of establishing customs controls for freight moving between Northern Ireland and Ireland without physical infrastructure or checks at the land border.

"We are confident that the proposal we outline can accommodate solutions to each of these issues."

There would be no infrastructure "at the land border". But there would be infrastructure.

Every trader would need a customs declaration for every consignment. The declaration could be done in the way imports and exports are normally handled with a third country: forms filled in outlining content, value, destination, rules-of-origin, tariff paid etc.

The British proposal said checks could be simplified and kept to a minimum, with exemptions for microbusinesses and SMEs, greater use of transit procedures, whereby checks are diminished through a financial bond.

Not every consignment would be physically checked - as in doors being opened -  but every consignment would still have to be declared when it left the North and went South (or vice versa), and then cleared again for entry into the new jurisdiction when it arrived on the other side.

The declaration could be checked by customs at the business premises, or "at inland customs clearance sites". Again, under this idea, such "sites", to all intents and purposes brand new customs posts, would have to be on both sides of the border.

The "non-paper" did not spell out how far back from the border these sites would be, but a source familiar with the process said it would be between five and ten miles.

This would make sense according to the logic of the paper. The consignments would be "under customs supervision" on their journey across an extended border hinterland.

In other words, the authorities would have to know that what was declared on the northern side was what actually turned up on the other side. The goods, according to the source, would be tracked in real time using GPS, possibly via a mobile phone app or a tracking device on the vehicle.

It would make no sense for the inland customs clearance sites to be a vast distance away because that would increase the risk of the consignment being added to or tampered with en route.

It would also expand the ambiguous belt of territory, containing towns and villages, people and traders, that fell between these customs clearance sites.

Downing Street flatly denied RTÉ's reporting of the "non-paper".

The Irish Government remained tight-lipped, but in Dublin the opposition expressed outrage at what was reported.

The day after the RTÉ report, Dublin was briefed by London on the actual legal text. David Frost had been expected to travel but he remained at the Conservative Party Conference in Manchester and the prime minister's chief strategic advisor Eddie Lister went instead.

Lister briefed Irish officials on the text, although short of actually giving them a copy.

That night Peter Foster, Europe Editor of the Daily Telegraph, published an exclusive and detailed report on what the paper called Boris Johnson's Brexit plan, revealing that the UK was now accepting that there would be broad regulatory alignment for Northern Ireland on industrial goods as well as agri-food, meaning a regulatory border on the Irish Sea, and also a customs border for goods going North to South, but one alleviated by "sweeping" exemptions from EU rules.

The Telegraph piece suggested checks would be done away from the border.

However, when it arrived, the explanatory note accompanying the 17-page legal text submitted by the UK on Wednesday said "physical checks – which would continue to be required only on a very small proportion of movements based on risk assessment – could then take place at traders' premises or other designated locations which could be located anywhere in Ireland or Northern Ireland".

On Thursday in the House of Commons, Boris Johnson was asked if there would be any new customs infrastructure on the island of Ireland.

He replied: "Absolutely not. The proposals we are putting forward do not involve physical infrastructure at or near the border - or indeed at any other place."

In Stockholm, the Taoiseach welcomed the remark, but noted it was "in contradiction" with the British paper.

Johnson was also asked what would happen if, at the end of the transition period, a free trade agreement with the EU had not been completed?

Johnson answered that if there was no trade agreement then both the EU and UK would revert to WTO terms.

So, having already asking the EU to promise never to install physical border infrastructure on the island of Ireland in his letter to Jean-Claude Juncker, Johnson was saying that a WTO scenario could descend in just 14 months' time, guaranteeing just that.

This did not go unnoticed by Irish officials.

Where to now?

The EU response to the UK paper was carefully calibrated not to slam the door shut immediately, knowing that if they did so the blame game would start immediately.

Jean-Claude Juncker and Michel Barnier were clear that any adjustments had to meet the objective of protecting the all-Ireland economy, no hard border and the integrity of the single market.

On Wednesday evening, the Commission briefed member states on the text, while Barnier addressed the Brexit Steering Group in the European Parliament (he also briefed EU27 ambassadors on Thursday).

At the ambassadors meeting, it was made clear by member states that it was way too early to create any kind of negotiating "tunnel".

There was a broad welcome that the UK had shifted on the regulatory issue, and that alignment would extend to both agri-food and industrial goods. Member states also acknowledged that the UK had accepted a role for the European Court of Justice in adjudicating the application of single market rules in Northern Ireland.

However, it was clear the customs proposals were the most troubling.

The EU was keen to get answers as to how it would work. At first glance Johnson's customs plans would require "massive" derogations from the EU's customs rule book, according to one source, and it would have to be worked out during the 14-month transition period.

"So it would be a carte blanche commitment," says one EU official, "and there's the lack of detail in most things."

According to another official, the paper kicks most of the customs ideas into the Joint Committee, the body to be made up of EU and UK officials already in the Withdrawal Agreement.

London was asking the EU to outsource the nature of EU customs law to this body, after the treaty had been ratified.

"This is completely legally fraught," said another EU diplomat. "You can't give an instruction to the Joint Committee to start rewriting the [European] Union Customs Code. This is not how these things work."

Whatever about the legal problems, the UK paper clearly didn't meet the EU's red lines on protecting the peace process.

"On customs the Commission was clear," said another senior EU figure. "The paper does not meet any of the objectives we have stated. We have not abandoned those objectives. We challenged them to bring forward something that meets the objectives, but it falls short."

The EU is also worried about the consent clause or Stormont Lock by which the Assembly and Executive would have to give their consent to Northern Ireland remaining aligned to EU single market rules on industrial goods and agri-food products six months before the end of the transition and every four years afterwards.

When they were briefed by the Commission on Wednesday night, EU member states regarded this, according to one source, as an "upfront unilateral veto" that would suit the DUP.

Irish sources suggest that Dublin was briefed by London that the plans would fall short of an overt veto, but when they saw the detail on Wednesday the plans seemed to go further.

Officials, therefore, say the EU has "a million" questions about the UK plans.

Attempts to get answers got under way during talks between David Frost and his counterpart Paulina Dejmek-Hack on Wednesday afternoon, carrying on into Thursday, and continuing at the UK ambassador's residence over dinner that night.

They resumed on Friday and will start again on Monday. On Friday, according to officials, there was a deeper engagement between both sides, with the Commission attempting to make it clear what elements of the UK plans would simply not be acceptable.

The signals from London are that Boris Johnson remains anxious to get a deal. It's understood the UK accepts EU reservations but believes that continuing to push the backstop, and, one presumes, its main objectives, will not work as it will ultimately not pass in the House of Commons.

On Friday night a UK spokesperson said: "We have made a significant offer this week. Our proposals represent a fair and reasonable compromise. We want a deal…

"Everybody must understand, however, that there is no path to a deal without replacing the backstop. If the EU also want a deal they must recognise this and work with us at pace to agree a new deal."

London insists that the proposals are part of a broad "landing zone", a signal that further movement is possible.

The cautious belief in Brussels is that Boris Johnson is open to shifting his position further, but how far? It's understood the Stormont consent issue can be worked on, but customs is a notoriously binary issue. When Theresa May tried to make it less binary, her plans foundered on the rocks of Chequers.

"The Commission will have to figure out in the coming days whether there is a margin for manoeuvre or not," says a senior EU diplomat.

"If not, I don’t think that we will be in a position to conclude an agreement."

We have a week to find out.