Theresa May will draw a line in the sand and refuse to accept any Brexit deal from Brussels that threatens to break up the United Kingdom, it has been reported.

The European Commission will release its draft withdrawal agreement on Wednesday (28 February) demanding the UK sign up to a legal commitment to stop a hard border on Ireland, even if it means there are customs checks between the north and the south.

But the prime minister will reject these as unacceptable even if a stalemate on the text could stall Brexit talks.

A Number 10 source told The Times: "We are fully committed to accepting the December agreement (in which May ruled out a hard border) but the EU should be absolutely clear that the prime minister is not going to sign up to anything that threatens the constitutional integrity of the UK or its common market".

The source also said that the government will also not accept the expected demand by the European Commission that the European Court of Justice (ECJ) will have the final say on any final Brexit deal.

"There are many issues on which we are in agreement with the EU but when it comes to these matters you can expect the government's response to be robust. This is a draft negotiating position by the EU and not...a final binding text," the source told the paper.

However it remains to be seen how the prime minister can square the circle between her insistence on not remaining in a customs' union, and preventing a hard border in Ireland, as set out in the so-called December accord.

It comes as her foreign minister Boris Johnson appeared to contemplate future customs border checks after the UK leaves the EU.

In a letter obtained by Sky News, he told the prime minister that 95% of traffic going between Northern Ireland and the Irish republic will still be unchecked if there were a hard border.

He seemed to suggest that the border could be managed as easily as London's congestion charging zone.

In his letter, Johnson plays down the "exaggerated impression" of "how important checks are" at EU external borders.

But opponents were quick to lambast the foreign secretary over any suggestion that a border check, abandoned after years of bloodshed, was nothing more serious than a London borough boundary change.

Labour's shadow Northern Ireland secretary Owen Smith said: "The Prime Minister should condemn these remarks immediately and seriously consider the position of her Foreign Secretary."

Shadow foreign secretary Emily Thornberry told Sky: "Is there no issue that he doesn't take seriously? Is there no issue that he thinks that he can't just get through by lying?"

Labour leader Jeremy Corbyn appears to have stolen a march on Theresa May by saying his party would back the UK being in the customs' union, which has been widely praised by business leaders.