Boris Johnson and the EU appear to be on the brink of a new Brexit deal in Brussels, with last-ditch talks continuing late into the night to meet a Wednesday deadline.

Speaking on Tuesday an optimistic Leo Varadkar even suggested that there might be no need for an Article 50 extension if an agreement could be sealed ahead of a make-or-break summit later this week.

If negotiators reach an agreement a draft text could be published on Wednesday, ready for EU leaders to approve at the upcoming European Council summit on Thursday – followed by parliamentary scrutiny in Westminster on Saturday.

Details from the secretive talks are scarce, but the latest sketchy reports from in the room suggest that the UK has agreed in principle to a customs border down the Irish Sea – which was originally rejected by Theresa May as something “no British prime minister” could accept.

As negotiators continued on Tuesday evening the taoiseach said the gap on the issue of customs was “still quite wide”, warning “there’s a difference between a pathway and an agreement”.

“Our objectives have always been the same, it’s to avoid a hard border north and south, it’s to allow the all-island economy to thrive, it’s to allow north-south cooperation to resume as envisaged in the Good Friday Agreement, but also the integrity of the single market,” the Irish prime minister said.

“That’s very much where the EU, our partners come in. I would never ask the commission or the member states to compromise the single market, because our jobs and our economy and our security depends on that too.

“We’re going to have to see how the next few days develop. If we can get to an agreement, on Thursday or Friday, and if the House of Commons is able to vote in favour of an indicative vote in favour of that agreement on Saturday, it may not be necessary to even consider an extension.”

But even if the House of Commons did agree to a new deal in an indicative vote, the ratification and implementation process in Westminster could be long and require a delay beyond 31 October.

The pathway to a majority in parliament is uncertain, with the DUP implacably opposed to a customs border down the Irish Sea, and hard Brexiteers Tory MPs likely to follow their lead.

But with a potential accord taking shape, both groups appeared open to details fed to them by Downing Street. Steve Baker, the chair of the European Research Group (ERG) described talks at No 10 as “very constructive”, adding: “I am optimistic that it is possible to reach a tolerable deal that I am able to vote for.”

There’s a difference between a pathway and an agreement Leo Varadkar, taoiseach

Speaking to BBC Northern Ireland’s Newsline programme, DUP leader Arlene Foster said some speculation about what a nascent detail contained was “so far off the mark that you cannot even see the mark anymore”.

“I think what’s important is that we stick with our principles, that we want to get a deal but that it has to be a deal that respects the economic and constitutional integrity of the United Kingdom and that means all of the United Kingdom – Northern Ireland included, and that’s very important for us,” she told the broadcaster.

The PM’s official spokesman also confirmed that Mr Johnson met with representatives of the DUP in No 10 on Monday evening, but declined to go into details of the discussions.

The day began with Michel Barnier, the EU’s chief negotiator, briefing EU27 ministers that a deal had to be finalised on Tuesday for it to be ready for a summit.

Mr Johnson is counting on having a deal in place for Thursday’s meeting in Brussels so he can have it ready when it faces MPs the next day in parliament for an emergency Saturday sitting.

Diplomats say Mr Barnier told ministers that UK proposals so far are not good enough, despite reports that UK presented yet another new legal text in talks on Monday.

Boris Johnson and Brexit merchandise for sale at the Tory conference Show all 10 1 /10 Boris Johnson and Brexit merchandise for sale at the Tory conference Boris Johnson and Brexit merchandise for sale at the Tory conference A Boris Johnson doll for sale at the Conservative Party Conference in Manchester on 29 September PA Boris Johnson and Brexit merchandise for sale at the Tory conference Mugs with Boris Johnson's portrait for sale at the Conservative Party Conference in Manchester on 29 September AP Boris Johnson and Brexit merchandise for sale at the Tory conference A Boris Johnson themed T-shirt for sale at the Conservative Party Conference in Manchester on 29 September AFP/Getty Boris Johnson and Brexit merchandise for sale at the Tory conference Boris Johnson and other Conservative themed cards for sale at the Conservative Party Conference in Manchester on 29 September AP Boris Johnson and Brexit merchandise for sale at the Tory conference Boris Johnson posters for sale at the Conservative Party Conference in Manchester on 29 September EPA Boris Johnson and Brexit merchandise for sale at the Tory conference Copies of The Conservative newspaper are ready to be distributed during the Conservative Party conference on 30 September Getty Boris Johnson and Brexit merchandise for sale at the Tory conference "GET BREXIT DONE" mugs alongside other Conservative merchandise at the party conference in Manchester on 29 September PA Boris Johnson and Brexit merchandise for sale at the Tory conference Assorted Conservative merchandise for sale at the party conference in Manchester on 29 September PA Boris Johnson and Brexit merchandise for sale at the Tory conference Books about Jacob Rees-Mogg and Jeremy Corbyn for sale at the Conservative Party conference in Manchester on 29 September Getty Boris Johnson and Brexit merchandise for sale at the Tory conference A variety of books for sale at the Conservative Party conference in Manchester on 29 September Getty

“As part of the talks process, there is of course back and forth and new texts have been shared by both sides repeatedly – that’s what a negotiation is,” a UK government spokesperson said on Tuesday as talks continued.

Going into the Luxembourg meeting with ministers, Mr Barnier struck an upbeat tone, telling reporters: “Even if agreement will be difficult – more and more difficult, to be frank – it is still possible this week.”

He added that that “work has been intense all through the weekend and yesterday”. Talks ran on until midnight on Monday, having entered a so-called “tunnel” of intensified negotiations on Friday.

Brexit secretary Steve Barclay, who was also in Luxembourg and who spoke with Mr Barnier at the margins, told reporters: “The talks are ongoing, we need to give them space to proceed but details conversations are under way and a deal is still very possible.”

If no deal is struck in time for this week’s summit, UK law will force Mr Johnson to delay Brexit yet again, breaking one of his key campaign pledges and opening him up to criticism from Brexiteers. Under the so-called Benn Act, the prime minister must request and accept an extension if no deal is in place by 19 October – when MPs will come to Westminster for their emergency Saturday sitting.

The failure to sign an agreement at the summit would likely mean that talks would continue into the next week.

Irish deputy prime minister Simon Coveney told reporters in Luxembourg: “I don’t want to raise expectations about later on today or this evening, but if there is going to be the positive report that is needed to EU capitals tomorrow in advance of the EU summit, then clearly a big step forward is needed today.

“It is of course possible to move beyond the summit and continue talks next week. That is feasible because the UK isn’t due to leave the EU until the end of the month.

“From everybody’s perspective, if we could provide clarity at this leaders summit, that would be a welcome development.”

Brexit deal is 'still possible' in time , claims Michel Barnier

For some EU leaders, however, it was already too late to get a deal for the meeting. Speaking on Monday, Antti Rinne, Finnish prime minister and holder of the rotating EU presidency, told reporters: “I think there is no time in a practical or legal way to find an agreement before the EU Council meeting. We need more time.”

Boris Johnson spoke about the progress of Brexit negotiations with French president Emmanuel Macron in a 20-minute phone call this morning which Downing Street described as “constructive”.

Asked whether the UK recognised Michel Barnier’s midnight deadline for a deal to be agreed, the PM’s spokesman said: “The prime minister is aware of the time constraints we are under. We want to make progress towards securing as soon as possible and we want to make progress ahead of the European Council on Thursday.”

Asked whether Mr Johnson would accept a technical delay to Brexit to finalise details once a deal had been agreed in outline, the spokesman said: “The PM has said on many occasions that we need to leave on 31 October.”

He confirmed that MPs would have to approve the political declaration on future EU/UK relations as well as the withdrawal agreement in order for a deal to be completed. He said that discussions have been taking place on the declaration – which covers issues like the ultimate trading relationship between the UK and EU – but declined to go into details of Britain’s proposals.