Theresa May arrived in Brussels late on Tuesday afternoon and went straight to a meeting with Donald Tusk, the President of the European Council.

It had been a gruelling day. She had hopped from The Hague, to Berlin, and on to Brussels, following the pummelling she had received 24 hours earlier over her decision to pull the meaningful vote from the House of Commons.

Her political future was hanging by a thread. From all sides hostile forces were circling: hardline Brexiteers in her party saw their dream of a straightforward Brexit disappearing before their eyes.

The Withdrawal Agreement would be a soft, or even pointless, Brexit. They had to move fast to stop it, and getting rid of Theresa May seemed the first step.

Letters from angry Tory MPs were landing in the office of Sir Graham Brady, the chair of the 1922 Committee. He would have to trigger a no-confidence motion if the numbers reached the 48 mark.

Her only defence to the swirling discontents in Westminster was that she had listened to the concerns of parliament and would now go off to have those concerns dealt with by European Union leaders.

In fact, her chief negotiator Olly Robbins had already been spotted in Brussels on Monday afternoon. Two sources said he was already talking to Sabine Weyand, Michel Barnier’s deputy negotiator on the EU Task Force.

Against the backdrop of furious speculation that the EU would help Theresa May - what one diplomat described as a "feeding frenzy" - the European Commission declared on Monday there would be no renegotiation of the text.

"Our position has not changed and as far as we are concerned, the United Kingdom is leaving the European Union on the 29th of March 2019," spokeswoman Mina Andreeva said. "We will not renegotiate."

When she arrived the next day, Mrs May asked Donald Tusk directly if the EU would agree to the Irish backstop lasting for just one year. Mr Tusk flatly refused.

"This was out of the question, not only for an Irish point of view," according to one source familiar with the meeting. "It’s totally against what was agreed. We had always said this was intended as an insurance policy, and you don’t take an insurance policy for a year."

Mrs May then made a second approach. Would the EU consider a two-step approach on the backstop? First, there would be political reassurances at the summit, then more legally robust clarifications in January, just before the Commons was due to return to the Withdrawal Agreement.

"That was the plan," according to one source close to the negotiations. "What they wanted to obtain was basically a softening of the backstop, something that indicates that it is really only temporary, that it is really not the intended end state of the negotiations, and that, given our level best efforts, the backstop would only apply for a year."

Donald Tusk tweeted after the meeting that it had been "long and frank". The EU wanted to help. But how?

Long and frank discussion with PM @theresa_may ahead of #Brexit summit. Clear that EU27 wants to help. The question is how. — Donald Tusk (@eucopresident) December 11, 2018

Theresa May returned from Brussels into the gathering storm of a no confidence motion. When it was triggered on Wednesday morning a succession of cabinet ministers were ready to signal their strong support for Mrs May, and by lunchtime more than 100 MPs had publicly declared their intention to vote for the prime minister.

Officials from EU institutions and member states were watching with alarm and bemusement. The initial reaction was that Mrs May needed to be helped, but as the day wore on that magnanimity receded somewhat. Maybe she was not in such great danger after all.

On Wednesday evening, Sir Graham Brady read out the results: 200 MPs supported her, but 117 had voted against her. It was an uncomfortably high number.

Outside Number 10, Mrs May said: "I have heard what the House of Commons said about the Northern Ireland backstop and, when I go to the European council tomorrow, I will be seeking legal and political assurances that will assuage the concerns that members of parliament have on that issue."

Throughout the day, there was feverish speculation in Brussels about what those "legal assurances" might be. The EU had a range of options at its disposal - declarations, protocols, codicils, interpretative mechanisms.

Attention shifted to a declaration that Dutch Prime Minister Mark Rutte was able to secure during a European Council summit in December 2016. He was Mrs May’s first port of call on Tuesday.

The Netherlands had rejected the EU-Ukraine Association Agreement by 61.1% in a referendum in 2015. Mr Rutte then spent almost a year negotiating a text that would help him get the agreement through the Dutch parliament.

The declaration stated that the agreement "does not confer on Ukraine the status of a candidate country for accession to the Union, nor does it constitute a commitment to confer such status to Ukraine in the future".

With other assurances on what the Association Agreement didn’t mean for the Netherlands, Mr Rutte was able to get it ratified in the parliament. The exercise was, indeed, a pact: the EU’s promise of a declaration was conditional on the prime minister’s promise to get the Dutch parliament on board.

This was obviously not something Theresa May could promise. But there were other differences: the Dutch declaration was made by the EU heads of government, and it was not binding on Ukraine.

The ratification process also depended on the consent of 28 member states and the Ukrainian government - essentially just one country was holding things up.

Attention then shifted to the EU-Canada trade deal (CETA) and the assurances needed to get the Belgian region of Wallonia to ratify. On that occasion, a Joint Interpretative Instrument, signed by the EU, member states and Canada, got the trade deal over the line.

The mechanism derives from Article 31 of the Vienna Convention on the Law of Treaties and it allowed for a binding interpretation of what the deal meant, but without changing the deal.

By Wednesday, following Mrs May’s whistle-stop tour of Europe, this appeared to be the avenue the UK was looking for. It was prompting nervousness, not least in Dublin, but also in other capitals.

"The more the Brits start spinning and talking about legal bases and the Vienna Convention," said one EU source, "the more people start to be suspicious. What are they trying to do with this? Is it in good faith?"

By Wednesday afternoon, senior figures were playing down the prospect of legal mechanisms. What was needed was to simply highlight what the deal said about the circumstances in which the backstop would apply.

"Additional written legal guarantees have not been discussed," insisted one diplomat. "The UK has asked for assurances. They don’t have to be dealt with through a legal mechanism because they’re clarifications, not interpretations."

Ireland has its own experience of protocols. Following the rejection of the Lisbon Treaty, the Irish government negotiated a set of protocols spelling out that the treaty did not impinge on Ireland’s neutrality, tax system or abortion laws.

Those protocols were lodged with the UN and later incorporated into the EU treaties.

But Irish officials are wary of any legal mechanism that attaches to a treaty. "We could not accept a codicil," said one source. "We haven’t seen anything yet. If they put forward a proposal you can examine it, but it’s hard to say what’s acceptable and what isn’t. But protocols would have the same effect as the Withdrawal Agreement. Adding to a text is opening a text."

On Wednesday afternoon, there was a key meeting of EU ambassadors to assess Britain’s demands. While no member state was leaping to Mrs May’s defence, there were varying positions on how the EU should respond.

One camp felt that if the UK was simply looking for a declaration that repeated what was already in the Withdrawal Agreement then there might not be a problem. There is language in both the Withdrawal Agreement and the Political Declaration spelling out that the backstop is designed to be temporary, "unless and until" something better comes along. If a declaration simply repeated that, then what would the harm be?

"Others were saying, let’s not be naive," according to one source briefed on the meeting. "The whole purpose of this is not innocent. It’s the kind of thing that can be used against us later on. It could be there to obstruct the Withdrawal Agreement and create more instability."

During the meeting the Irish delegation made number of key interventions. Ireland’s position was described as "assertive" rather than "defensive".

"Ireland have got what they wanted in the Withdrawal Agreement. They’ve got something to defend that’s there already."

Ireland was particularly concerned about the one year backstop request.

"The Irish were absolutely fuming at the idea they could be even suggesting it," says one source. "That is contrary to the logic of the backstop."

Irish officials also expressed concern that the EU could go too far in characterising the backstop as something that was not wanted.

"The Irish are mindful of anything which portrays the backstop as anything which is inoperable or not a solution," said one EU official. "It’s a last resort insurance policy, but it’s not an undesirable, unsound, unworkable thing. If you portray your last resort insurance in such dark terms you’re never going to be able to use it."

Irish officials were also concerned that in the foam and fury of Westminster over the "hated Irish backstop", member states might forget how the backstop had evolved. According to one senior figure, "The backstop is not some weird outcrop of a small country that doesn’t know its place. This is an absolutely clear and necessary condition of those [EU] priorities and also those [British] red lines that we’ve seen".

While Mrs May was undergoing her confidence motion on Wednesday night, officials from the European Commission and the European Council, which represents the member states, were already drafting a statement on her demands that leaders could discuss on Thursday night, once she had made her sales pitch on those legal and political assurances.

The draft was an unusual paper in that it was designed as a "framework" around which the debate could take place. That meant that its elements could change throughout Thursday, and it would be leaders themselves who were doing the drafting at the summit.

On Thursday morning, Reuters reported a six-paragraph statement that offered a blend of reassurances over the backstop and warnings that the Withdrawal Agreement would not be reopened.

The draft said the backstop did not "represent a desirable outcome" and was only intended as an insurance policy. If it was triggered, the EU would use "best endeavours" to quickly agree a replacement, so that the "backstop will not be needed".

The backstop would apply "only temporarily, unless and until" a new agreement was in place. The EU "stands ready to examine whether any further assurance can be provided", so long as it would not "change or contradict" the deal.

A short time later, there was a hastily arranged bilateral between Mrs May and the Taoiseach in the Irish delegation room of the Europa Building, the seat of the European Council.

The meeting lasted 50 minutes. Speaking to journalists afterwards the Taoiseach said it had been a "long" meeting. The prime minister had brought forward some ideas that "made sense" and others that were "difficult".

But rather than focus directly on the backstop, its nature or duration, Mrs May focused almost exclusively the need to speed up a free trade agreement as the best way of ensuring the backstop might not need to ever take effect.

Irish officials would not characterise the meeting other than that it was longer than usual. However, another EU source said it had been "frosty".

"The Irish side was very much against the idea of giving any impression, anything at all that could risk reopening the text, but also giving the impression that that possibility might still be out there," said the source.

Another source said: "The Taoiseach was strong in saying the Withdrawal Agreement couldn’t be amended. Her view was that to get the numbers across the line in the House of Commons meant the EU should be able to do something.

"The biggest worry [according to Mrs May] is that the backstop is going to be used to tie the UK to the EU, but because the Withdrawal Agreement is legally binding ... the fear is there’s no onus on the EU to negotiate a future [trade agreement], that the backstop could just be there indefinitely. She wants greater clarity or assurance that the Free Trade Agreement will be negotiated as quickly as possible."

Around 7.30pm on Thursday evening Theresa May finally made her pitch to the EU 27. By midnight, it was clear her pitch had fallen flat: EU leaders hardened their position, offering straightforward clarifications, but dropping the paragraph promising "additional assurances" and the language that said the backstop was "not a desirable outcome".

What went wrong?

According to officials briefed on the meeting, the prime minister made three demands on how to "soften" the backstop for MPs in the House of Commons.

The first was that the Free Trade Agreement (FTA) should be concluded by December 2021 at the latest; the second, that the Political Declaration, which sketches an ambitious future free trade deal, should be converted into an annex of the Withdrawal Agreement to make it legally binding; and third, that the preparations for the trade talks should start as soon as the Commons and European Parliament gave their consent (ie, before Britain formally left the EU at the end of March).

The EU leaders listened in amazement, and for different reasons.

The most glaring problem was the second proposal. The idea that the EU would agree to suddenly converting an aspirational - even fuzzy - declaration into a legally binding annex of the treaty, simply to get the EU to use its "best endeavours" to conclude the trade deal quickly, was regarded as outlandish.

It was also something that had been floated - and rejected - in the negotiating "tunnel".

For those leaders who were not fully au fait with the intricacies of the tunnel it also seemed to be a strange suggestion. Leaders wanted to know how Theresa May was going to proselytise the House of Commons, and the wider public, on the backstop. She would have to think more broadly than obscure legal manoeuvres.

The first suggestion was equally problematic. It appeared that having been told the backstop couldn’t have an expiry date of one year, Mrs May tried to turn the idea into a positive, by suggesting, instead, a hard deadline for the trade deal to be concluded.

According to officials familiar with the discussion, leaders regarded this as completely unacceptable. Not only is a hard deadline for a trade deal completely unfeasible, it would also allow the UK to shift the blame on the EU if the deadline wasn’t met.

The other obvious point was that the mere completion of a deal does not banish the backstop forever. The content of the deal is what counts, and in order to avoid a hard border in Ireland, the FTA would have to be one of high alignment on customs and single market rules.

This is signposted in the Political Declaration, but EU leaders are of the view that neither the prime minister, nor the House of Commons, nor the public at large have metabolised such a destiny and certainly won’t have in time for the January vote.

"The feeling in the room was that the UK has to have a grown up discussion about this," said the source.

Theresa May left the summit still smarting over an apparent reference by Jean-Claude Juncker that her presentation was nebulous.

The spat obscured the reality that there remains a huge gulf between the EU’s view of the Withdrawal Agreement and its future relationship with the UK, and where the House of Commons sees things.

Within that gulf lurks the no deal scenario, or perhaps a second referendum. No one knows. And after one of the most dramatic weeks yet, we are none the wiser.