Negotiators virtually clinched a Brexit deal Wednesday night — with just a dispute over value-added tax standing in the way.

All of the other thorniest disputes in the divorce decree had been ironed out, according to five EU diplomats, including highly sensitive provisions for managing the Ireland-Northern Ireland border that had long been the main obstacle to an agreement.

Word that negotiators had nearly reached a deal came after an intense day of negotiations on the eve of a summit of EU leaders in Brussels, billed as a last chance for British Prime Minister Boris Johnson to push through a deal before the deadline of October 31 for pulling the U.K. out of the EU.

However, clinching an accord among negotiators has never been the toughest hurdle in the Brexit process — and clear political obstacles remain. U.K. Prime Minister Boris Johnson personally had not yet signed off on the negotiators' work, diplomats said.

Johnson told his Cabinet earlier in the afternoon that there was "a chance of securing a good deal," his spokesman said, but there are still "a number of outstanding issues."

The U.K. government is struggling to win over the support of the Northern Irish Democratic Unionist Party after a series of meetings in Downing Street. Without the DUP it looks very difficult for Johnson to push a deal through the House of Commons, in part because he lacks a majority and also because DUP support could unlock another key faction, Tory Brexiteers.

“As things stand, we could not support what is being suggested on customs and consent issues and there is a lack of clarity on VAT,” DUP leader Arlene Foster and deputy leader Nigel Dodds said in a joint statement.

EU leaders twice delayed a meeting of EU27 ambassadors Wednesday originally scheduled for 2 p.m. The bloc's chief negotiator, Michel Barnier, eventually briefed them on the state of negotiations after 7 p.m.

“We have a provisional agreement on all points but not on VAT,” a senior official said after the briefing. A second diplomat confirmed that “almost all open points have been agreed on at negotiator level exception for the VAT.”

The outstanding issue on VAT stemmed from a demand by the British side to impose its own levy regime in Northern Ireland — as part of a complex customs arrangement that would kick in after December 30, 2020 at the end of an envisioned transition period — provided the two sides have yet to agree a broader free trade deal.

Negotiations are still continuing and diplomats said they did not expect the talks to collapse over of the VAT issue — for the EU, however, it is a red line.

While accepting a customs border down the Irish Sea, the proposed deal would keep Northern Ireland within the U.K.'s customs remit when it comes to trade, diplomats say.

London “wants Northern Ireland to have a separate VAT regime from that of the rest of the EU despite being in the [EU] Customs Union,” a senior diplomat said.

Negotiations are still continuing and diplomats said they did not expect the talks to collapse over of the VAT issue. For the EU, however, it is a red line.

“I don't think it will collapse because of it," another diplomat said, "but we remain cautious.”

With the EU side at least, the controversial issue of democratic consent for the deal in Northern Ireland appeared to have been resolves, although it was unclear how.

In addition to securing final agreements on the U.K. side, diplomats cautioned that the draft legal text, which is required in order to present any deal at this week's European Council summit for leaders' approval, was not yet ready.

“The text of the treaty has not yet been finalized and a number of ambassadors are therefore very concerned that the text will not be available in time for the start of the European Council,” one diplomat said.

The diplomat cautioned that leaders would likely be reluctant to endorse any agreement that had not yet been vetted by experts in their capitals.

A meeting of the Working Party Article 50, a group of Brexit experts in the Council, was expected to examine the deal at a meeting on Thursday morning.

Diplomats on Wednesday night also reported progress on the Political Declaration, a statement about both sides' intended future relationship which will accompany the legally-binding Withdrawal Agreement. They said London has now accepted some provisions aimed at creating a so-called "level playing field" in any future free trade agreement.

Such provisions were a core component of the Political Declaration agreed by Johnson's predecessor, Theresa May. Johnson's refusal to back the proposals so far raised fears in Brussels and national EU27 capitals that he intends for Britain to become a strong competitor to the EU.

German Chancellor Angela Merkel said earlier this week that in this case the EU should be prepared to treat the U.K as a strong competitor.

Yet according to two diplomats, the plan includes an ambition to strike a free-trade agreement with zero quotas and zero tariffs but “with strong references to Paris [climate] agreement, tax provisions, state aid provisions,... and explicit reference to appropriate implementation mechanisms,” one of the diplomats said.

The second diplomat confirmed the components of the Political Declaration, saying: “In this way we limit [market] distortion," and the risk of "dumping" of goods produced to lower and cheaper standards.

A Downing Street official said that while no deal was expected to be struck on Wednesday evening, “negotiations are continuing this evening on the last few areas where there are clearly hurdles.” While declining to comment on the details of the discussions, the official did not dispute that VAT was a final outstanding issue.

Charlie Cooper contributed reporting.