It was the evening of 20 January 2016. The Brexit referendum was safely five months away.

Theresa May arrived at the Irish Embassy in Grosvenor Square to deliver a speech in honour of the Journalists’ Charity. As she was greeted by ambassador Dan Mulhall journalists noticed she was not wearing her trademark kitten heels. Instead she was sporting a pair of diamante heel boots.

One fashion reporter present noted the same boots had been worn by the Spice Girls.

Indeed, it was a fun evening. Mrs May, then Home Secretary and a very outside candidate to become leader one day, was witty and generous in her tribute to the work journalists do, recalling roguishly how she enjoyed the BBC’s War and Peace, "watching all those characters… coming out in support of Mother Russia, and not least of all, Andrew Marr interviewing the Labour leader".

She was thanked by the charity organiser for being "on form" and for helping to give the annual reception "such a buzz."

A senior Irish diplomat recalled: "She was less frosty and warmer than I had anticipated. She had an image of being rather austere, but she was quite good fun and quite amusing."

Ambassador Mulhall steered clear of the upcoming Brexit referendum. With an eye to the Easter Rising and Battle of the Somme centenaries, he said that both countries could view both events with a different set responses, "no longer worried by the friction of the past, and… within a relationship that has never been better."

Three-and-a-half years later, Theresa May has tearfully departed Number 10 Downing Street, her reputation in ruins, a figure broken by Brexit, and - through the backstop - broken by the very relationship that Ambassador Mulhall had so warmly invoked.

While her destruction, so long anticipated, has been plotted by the harder wings of the Tory Party, her interlocutors in Ireland and Europe will acknowledge that Theresa May tried - in ways that were sometimes genuine, sometimes muddled - to reconcile the titanic contradictions at the heart of Brexit: how to leave the customs union and single market and maintain an invisible border on the island of Ireland.

Her offer of a vote in the House of Commons on whether to have a second referendum may have been the final miscalculation, but her acceptance of the backstop, and the painful implications it would herald, have long kept her at the brink.

Numerous conversations with British, Irish and EU officials depict a leader who was honourable and courageous, but who fundamentally lacked the flexibility, political skills, even a very basic grasp of EU law, or a realistic notion of what Europe would accept, in order to have a chance at steering a deeply divided country in the right direction.

"She didn't have any intuitive feel for the Irish issue," says one senior British official who worked closely with her. "None whatever. There was no understanding at the heart of Number 10. There was no even-handedness."

Another senior British diplomat and keen observer of British-Irish relations agrees, points to the lack of an eminence grise within Downing Street who might have ensured the even-handed approach of Tony Blair’s chief-of-staff Jonathan Powell during the Peace Process.

However, when Theresa May became leader just five months after that memorable evening at the Irish Embassy, Dublin was cautiously hopeful that the warm relationship might continue.

"We would have known Theresa May as Home Secretary," recalled a senior figure in the Department of Justice. "She was a very stable, sober, thoughtful person."

Another Irish diplomat had watched the leadership battle. "The feeling was she was the best on offer. [George] Osborne, Boris [Johnson] and [Michael] Gove were cancelling each other out. Stephen Crab, Andrea Leadsom - awful. Theresa May was far and away the most adult of the bunch."

But the most adult of the bunch had an immediate challenge. She was a remainer at the helm of a hard Brexit party.

The need to convince her rivals she could mimic the strain of Brexit running through the party meant bringing those rivals on board. She moved quickly to create a brand new department for exiting the European Union, and appointed a string of hard Brexiteers to all the key cabinet positions.

Irish officials looked on with concern. "Because she was a remainer it was an attempt to pull the thing together," said one senior Irish figure at the time.

"Then of course she appointed Boris, [Liam] Fox and Davis - which was its own signal."

Dublin would look for other signals when Enda Kenny arrived for lunch in Downing Street just 13 days after she became prime minister. But there were none.

Mrs May appeared to say all the right things.There should be no return to a hard border, the Common Travel Area should be maintained, and so on.

But she would not say how. Nor was there any of the warmth than Kenny and David Cameron had enjoyed. Indeed, officials noted that instead of three courses, which Cameron always offered, Mrs May offered two (she ate a bowl of fruit for dessert, and not the pavlova the others had, due to her diabetes).

She seemed to constantly defer to Fiona Hill, who along with Nick Timothy, was one of the key advisers determining her Brexit strategy.

"She was pretty much an unknown quantity," recalls one source present. "In conversation she was very wooden and mechanical in the way she approached things. There were these awkward silences. She was very cagey, no apparent wish to get into small talk - Enda was a man who would chat away with anyone."

However, Dublin was sufficiently reassured that she meant what she said when wanting to avoid a "return to the borders of the past."

How would that happen if the UK went for a hard Brexit, by leaving both the single market and the customs union?

In the months that followed, Dublin demurred, accepting that Mrs May had to establish her credentials within her party, while waiting for a signal that she understood the need for a soft Brexit - at the very least - if those borders of the past were not to return.

Leaving the customs union would cause a clear problem on the island of Ireland, if both parts were in different legal orders.

"The customs union idea we knew was going to be huge," said one Irish negotiator at the time. "But we didn't know where it was going to land. There was a lot of talk of them potentially staying in the customs union."

Those hopes were dashed on 5 October. At her first party conference speech in Birmingham, Theresa May displayed both her hard Brexit credentials, and the cake-and-eat it approach that would bedevil the negotiations.

The EU’s authority in Britain had "ended forever", she told the party, yet she wanted "to give British companies the maximum freedom to trade with and operate within the Single Market,"

Three months later on 17 January 2017, the Prime Minister went further at Lancaster House. Declaiming a stirring vision of "Global Britain" she warned that "what I am proposing cannot mean membership of the single market."

As for the customs union, she wanted a "customs arrangement" and that could mean "a completely new customs agreement… becom[ing] an associate member of the Customs Union in some way, or remain[ing] a signatory to some elements of it, I hold no preconceived position."

EU officials were baffled. Dublin strained to see a door that might still be open.

The key to understanding the contradictions that ran through the speech and her negotiating strategy was to be found in May’s secretive style, her experience of the EU as Home Secretary and the appointments she had made

On becoming leader Theresa May surrounded herself with Home Office advisers. Nick Timothy and Fiona Hill were the closest. They saw Brexit as the gateway to a blue collar Tory revival. It would reconnect the party to the working class, away from the cosmopolitanism of free movement and migration. The Osborne-Cameron era had brought the Tories too close to big business and multinationals.

The other key Home Office personnel were Mark Sedwill, the permanent secretary, Stephen Parkinson, an adviser, and, of course, Olly Robbins, a former deputy National Security Adviser.

Robbins was appointed head of the European and Global Issues Secretariat in Downing Street before he became permanent secretary of the new Department of Exiting the European Union (DexEU).

Within two months he was made Theresa May’s chief Brexit adviser and sherpa, the envoy who would shuttle between Number 10 and the EU.

This set up an immediate clash. As chief civil servant in the new department he was answerable to David Davis. Yet he was closely involved in Theresa May’s strategy and understanding of the issues.

Mrs May was now surrounded by people who had no instinctive feel for the Irish issue. By the autumn of 2016 the key figures in charge of the Irish question were Sir Ivan Rogers, Britain’s ambassador to the EU, Olly Robbins and the Cabinet Secretary Sir Jeremy Heywood.

While Robbins had enjoyed a working relationship with John Callinan, Dublin’s new lead official on Brexit from their days liaising on Northern Ireland, critics said he had no instinctive knowledge of contemporary EU policies.

That left Sir Ivan as the key resource when it came to European thinking. But he was clearly out-numbered by May’s hostile Home Office disciples. According to one source closely involved, Nick Timothy regarded Rogers as "the enemy" and "on the wrong side of history".

Rogers eventually resigned in early January 2017 after a briefing against him that he suspected came from the heart of Downing Street.

If May’s strategy was being shaped by Timothy and Hill, her tactical understanding of the negotiating process was shaped by her time as Home Secretary.

Under the Lisbon Treaty, Britain had secured a five year opt-out on EU police and judicial cooperation legislation. When the five years was up, Britain had to choose which areas of cooperation it wished to opt back in to.

That job fell to Theresa May as Home Secretary in the Tory-Lib Dem coalition. Over a tortuous 18 month period, amid endless wrangling between the Home Office, the Ministry for Justice, the Lib Dems and the Conservatives, the UK opted back in to 35 out of 133 legal instruments.

On many of the 133 areas, May would tell her officials that they should go back and seek more concessions, especially from "the French and Germans", according to one official involved.

When she was told that it wasn’t possible - on something like the European Arrest Warrant (EAW) - she would have to then go and do battle with "a hundred Tory backbenchers."

That set the template for how Mrs May approached the Brexit negotiations: Britain would pick and chose which bits of the EU it wanted to stay in, and which it wanted to leave.

"The big problem was that she thought the whole world was like this [Justice and Home Affairs] negotiation," recalls a senior figure involved.

"One of the most unpopular things I said to her in September 2016 was, the world isn’t really like the JHA. Once you’re dealing with the single market, the EU doesn’t work like that. That didn’t go down very well. She kept on telling me, you’ve got to get away from the old fashioned binary thinking of the past."

Things were made worse by her determination not to share her negotiating tactics beyond a tight circle.

"She operates in this very, very secretive, very closed loop," recalled one official.

"She doesn’t communicate well with the party. She doesn’t have strong relationships with anyone. She doesn’t work the tea rooms. She doesn’t have a phalanx of May-ites in the cabinet either. This is her style."

The style became increasingly problematic in her dealings with Enda Kenny as the negotiations approached in 2017. There was the hard Brexit signalling and the red lines of the Lancaster House speech, yet ambivalence in private. Dublin was growing increasingly impatient with the British approach.

In February, Kenny adopted a harder tone. "Fewer than 350,000 people voted for Brexit in Northern Ireland, out of a total population of over 1.8 million," he told the IIEA.

"Let me also make one thing absolutely clear - Ireland will be on the EU side of the table when the negotiations begin."

There was a meeting between the two on 9 March in Brussels. By now Dublin wanted to know when exactly May was going to trigger Article 50 to start the negotiation process.

"The Taoiseach had a good and forthright relationship [with May]," says one official present. "There was a fair degree of openness, honesty and warmth in their exchanges."

However, when Kenny asked May upfront when she would trigger Article 50, she replied Sphinx-like that it would be "by the end of March".

On 29 March, Theresa May triggered Article 50. Three weeks later she stunned the world by announcing a general election.

Irish officials hoped for the best. "Let’s assume she’s done this to get a mandate which involves coherence and predictability," said a senior Irish diplomat at the time. "From that perspective a clear mandate is better than no mandate, or better than the chipping away of her position by hard Brexiteers."

But coherence and predictability was the last thing her gamble delivered.

Not only did she lose 13 seats, Labour gained 30 and she ended up relying on ten DUP MPs for her survival.

The chipping away by Brexiteers would get a lot worse, but now Dublin also had to contend with the Brexiteer unionists having a stranglehold on Theresa May's every move.

Dublin looked for any glint of comfort. The DUP were on record as saying they wanted to avoid a hard border. Could they steer her in the right direction? The election was also seen as a rejection of her hard Brexit position by the electorate. Could this help her land on a softer position?

The answer was no. An already secretive, furtive policy simply became more secretive and furtive.

"It’s almost as if none of that happened," said one exasperated Irish official, referring to the election result.

"They’re sticking to plan A. On the other hand, it's clear there's huge pressure on her within her own party and the business community and from others for a more cross-party approach, more debate about what sort of Brexit it should be. But that hasn't translated yet into any meaningful change of position. It may not."

The Grenfell Tower disaster and May's muddled handling of the aftermath made things worse.

"She's going through a torrid time, as if things weren't bad enough for her," said the official. "She's making a complete mess of things. She's under domestic pressure, which in a weird way is actually producing the absence of a plan. She's almost afraid to come down on firmer position, even if it means moving to a softer Brexit."

Then there was the change in Dublin. Leo Varadkar replaced Enda Kenny as Taoiseach. The broad sweep of Ireland’s strategy, outsourcing the Irish border to the EU which had embedded it as one of three key priorities in the first part of the negotiations, did not change, but Varadkar and Kenny were very different personalities.

"When she met Varadkar there was a kind of negative chemistry," one senior Irish official told me shortly after news broke of her resignation.

"He’s not an easy person necessarily, and they didn’t get on. It did develop a bit over time, but it wasn’t a close relationship. It was nothing like Enda with Cameron, still less like [Tony] Blair and Bertie [Ahern]."

By the autumn of 2017, four months into the negotiations, relations with Varadkar worsened. Britain seemed to have completely misread the EU’s determination to support Ireland in avoiding a hard border.

The promise by the EU to find "flexible and imaginitive" solutions turned out to be more than soothing words. By November it meant pushing Britain out of its comfort zone to contemplate some kind of differential between Northern Ireland and the rest of the UK if other ways couldn't be found to keep the border open and protect the all-island economy.

The backstop, as it became known, was a new and explosive development which caught London entirely off-guard.

A bilateral on the margins of an informal summit in Gothenburg was the low point. Varadkar and May were crammed into a meeting room so small their knees were almost touching under the table.

British officials say May was angry that Ireland somehow had a veto on progress. Varadkar was blunt. Theresa May had taken membership of the single market and customs union off the table, so Ireland was taking a hard border off the table by way of a backstop.

Afterwards there were incompatible interpretations of the meeting. British officials were convinced both sides had agreed that what was important was the outcome, not the methodology (in other words, the idea of "no regulatory divergence" between North and South).

Irish officials had a different take: "They pushed this idea that we were all on the same page," said one diplomat briefed on the meeting. "We were not on the same page. Again, it was this tendency to minimise the force of our concerns. The Irish will roll over."

Eventually a messy compromise was found with the Joint Report of December 2017. "No regulatory divergence" was changed to "continued regulatory alignment" if technology or a trade deal did not deliver the absence of a hard border.

The DUP dramatically torpedoed the first text, but a redraft included language on ensuring no trade barriers between Northern Ireland and Great Britain, should the backstop take effect.

But it was still a fatal concession by Theresa May, and it sowed the seeds of her downfall 18 months later. It wrecked any trust between the DUP and Downing Street, and it fundamentally limited her room for manoeuvre when dealing with Ireland and the EU.

So long as the Joint Report existed, May’s electoral survival was on tenter hooks. The DUP would not tolerate any differential between Northern Ireland and Great Britain; the EU offered little beyond promises to avoid the backstop coming into effect if at all possible.

Under the pressure of the October deadline, her only way to avoid destroying the Confidence and Supply Agreement with the DUP, without being in breach of the Joint Report, was to propose a UK-wide customs union.

She also had one eye on the business community, and the need to protect vast and valuable supply chains predicated on frictionless trade.

But this pulled down the entire Tory Party on her head. The interpretation of this temporary customs contraption - designed to avoid a customs border along the Irish Sea - meant that the painfully negotiated Withdrawal Agreement, concluded on 13 November 2018 would have no chance of ratification.

While her determination to square the all the circles won her admiration in Europe - and vilification at home - it was arguably the perpetually furtive approach to the talks which led to those impossible contradictions and ultimately to her downfall.

"The only way she did it was by continuing to assert these contradictory principles all along," says one senior Irish official.

"As we know, the lurch to the all UK-customs arrangement was an absolute disaster. There was a number of Tories who opposed her over the Northern Irish backstop, but I think the number who would have opposed her had she not gone for the UK-wide backstop would have been much smaller.

"On the positive side, people thought she did finally get the Irish issue, and she very doggedly stuck to the basic principles, which was admirable given all the pressure.

"It wasn’t that she personally was being Machievellian. I think she was under this enormous pressure all along the way. She looked desperately for fixes, but there was never any doubt about her sincerity."

That sincerity, and that sense that she really did finally get the Irish dilemma, was on display in Belfast on 5 February this year.

She told business leaders at the Waterfront Hall: "Any border that weaves its way through farms and villages, bisects hundreds of roads and lanes, and which is crossed and re-crossed by thousands of people every day would pose a logistical challenge in the context of Brexit.

"But when you add to those geographical factors Northern Ireland’s complex history, the different traditions and identities that make up its community, and the long path to peace that the people of Northern Ireland have walked over the last 40 years - the challenge is even greater.

"I understand how thousands of people move back and forth between Northern Ireland and Ireland every day - to go to work, to visit family, even to do their shopping. I understand what a hard border would mean - not just in terms of the disruption at the border itself, but in terms of trade for the whole island.

"The Belfast Agreement delivers 'just and equal treatment for the identity, ethos and aspirations of both communities.' And for many a seamless border between Northern Ireland and Ireland is integral to delivering this."

It was a speech that Leo Varadkar or Enda Kenny could have given. And anyone who understood even the very basics of the collision between Brexit and the Peace Process would struggle to disagree with it.

But it was too late. The hearts and minds in Westminster were long since closed.

History may well judge that the contradictions, misapprehensions, delusions and frustrated expectations that go to the heart of Brexit would have brought any Conservative leader down.

Theresa May’s handling of it, her strategic errors, her deliberate refusal to level with her cabinet, party, parliament and public, the savage spitefulness of the hard Brexiteers, for whom the Irish question has been one giant scam, have meant that her downfall has been just excruciating to watch.

The very same chalice will now be passed to her successor.