British Prime Minister Theresa May is facing a fresh Brexit headache as her plans - outlined in a letter seen by the Times of London -  risked a rift with her Democratic Unionist Party allies.

The beginning of her letter to the DUP is a bit confusing: "A Brussels plan to put a customs border in the Irish Sea if there is no Brexit agreement will be included in a divorce deal".

The idea of a no Brexit agreement usually means no divorce deal, so it sounds contradictory i.e., if there is no divorce deal we’ll have this in the divorce deal.

This might be nitpicking however.

In the letter Mrs May says: "The EU has proposed that, although [a UK-wide customs deal] could be negotiated in the future, they want to maintain a Northern Ireland only ‘backstop to the backstop’ in case the future negotiations are unsuccessful…"

[The UK-wide customs deal is Britain’s alternative to the original NI-specific backstop. That's why May calls the original a "backstop to the backstop"].

So, Mrs May is saying that if the long-term free trade negotiations are "unsuccessful" then the EU wants the Northern Ireland-specific backstop to take over. That would indeed involve Northern Ireland staying in the customs union and single market for goods.

But what does "unsuccessful" mean? Does it mean the Free Trade Agreement negotiations break down? Or does it mean they don't deliver the all important guarantee that there's no need for customs or regulatory controls on the Irish border?

If it's the latter then Dublin has a problem. That's because Dublin is insisting that a Northern Ireland-specific backstop is required as the ultimate guarantee of no hard border, especially if for example a future FTA doesn't keep the EU and UK sufficiently close so as to avoid customs controls.

Mrs May says: "I could not accept there being any circumstances or conditions in which that 'backstop to the backstop', which would break up the UK customs territory, could come into force.

This is there to reassure the DUP, but it will not reassure Dublin or the EU.

Mrs May also reinforces the notion that the "backstop" must be temporary.

She writes: "We should be clear that the backstop would only ever be temporary. This is inherent in the Article 50 legal base on which the withdrawal agreement will be founded, which cannot aim to establish a permanent relationship".

This is interesting logic, whether she means the NI-specific backstop or the Temporary Customs Arrangement (TCA)? The EU has always resisted having the TCA in the Withdrawal Agreement because Article 50 is the wrong legal basis for what is really a future relationship issue.

But London persisted, saying the TCA has to be legally binding in the Withdrawal Agreement, and not a "vague promise" in the Political Declaration which will accompany it.

But here Mrs May seems to want to have her legal cake and eat it. On the one hand she's arguing the "backstop" has to be temporary because Article 50 demands that it’s temporary (i.e., Article 50 can’t "establish a permanent relationship").

She’s effectively throwing the EU’s own legal logic back at Brussels: the backstop (either the NI-specific one or the TCA) can’t be permanent because Article 50 is only a divorce treaty, not a future relationship treaty.

And yet on the other hand London is asking Brussels to bend the rules so that the Article 50 Withdrawal Agreement can accommodate the UK-wide customs union, which is a future relationship issue.

Mrs May continues: "This position [that the "backstop" must be temporary] will need to be reflected in any backstop legal text we agree with the EU. Furthermore I have been very clear that the government I lead would not accept being kept in a backstop arrangement indefinitely."

It’s worth pointing out that Dublin agrees the backstop is "temporary". But not because Article 50 makes it temporary, but rather because of an aspiration that something better will come along. The backstop applies "unless and until" that replacement someday arrives.

Mrs May then raises another interesting point. "I fully understood [the DUP’s] concerns that the backstop could become a legal mechanism which could be resurrected once we have our future relationship in place."

So, the DUP - and Mrs May - worry that even after the future trade deal is negotiated Dublin and Brussels will somehow try to "resurrect" the backstop.

But according to the logic of the Joint Report, the backstop applies if the future FTA falls short in avoiding a hard border. So it would not be that a hitherto dead backstop is "resurrected". The Joint Report means that the backstop would actually be legally required if the FTA falls short

May continues: "When our future [FTA] deal - which of course will avoid a hard border - comes into force the backstop must be legally superseded by that future relationship."

There is impressive confidence here. The FTA will "of course" avoid a hard border. Will it? Only if it involves high alignment of regulations and customs. The whole logic of Paragraph 49 of the Joint Report is that it implies that a future FTA might not avoid a hard border.

If it does, then Mrs May is right: the backstop will be "superseded" by the FTA, and that is already agreed by all sides in Article 15 of the draft Withdrawal Treaty. But it’s a highly conditional "if".

So, Dublin sees the Withdrawal Agreement as guaranteeing no hard border. London sees it as guaranteeing no long term, NI-specific backstop. This spells trouble.

Mrs May's letter was in response to this letter sent by the DUP on 1 November.