THERESA May turned against a no-deal Brexit because she feared it would threaten the Union, her former chief of staff has confirmed.

Gavin Barwell said Mrs May, who famously proclaimed “no-deal is better than a bad deal”, changed her mind after visiting Northern Ireland.

He said she had been concerned about the combined effect of a return of a hard border with the Republic of Ireland and the lack of stable government in the North.

READ MORE: SNP say Ruth Davidson ‘humiliated’ after David Mundell sacked against her advice

The devolved power-sharing executive and assembly collapsed in January 2017 after disagreements between the DUP and Sinn Fein.

Mrs May included a coded warning against no-deal in her farewell speech in Downing Street yesterday, calling for a Brexit that “works for the whole of the United Kingdom”.

Mr Barwell, a former Tory MP, told BBC Radio 4’s Today programme that Mrs May was worried a no-deal Brexit could drive support for Irish unification.

He said: “She is a passionate unionist and she has spent a significant amount of time in Northern Ireland during her premiership.

“And every time she visited, that, sort of, sense that the combination of Brexit and what it could mean to the border between Northern Ireland and Ireland and the lack of devolved government in Northern Ireland that there was a real threat.

“The Secretary of State for Northern Ireland is on a statutory duty to call a border poll if she believes there is evidence to support one. So, that is a real concern to her, yes.”

Mrs May was also warned about the impact of a no-deal by her Scottish Secretary David Mundell, who identified it as potential fuel for the Scottish independence movement.

Both Northern Ireland and Scotland voted Remain in the 2016 EU referendum.

Earlier this month, Mr Mundell wrote in a newspaper that First Minister Nicola Sturgeon would seize on a disorderly Brexit “with unseemly glee”.

READ MORE: Boris Johnson holding first cabinet meeting 

He said: “A difficult no-deal Brexit would not only damage our economy, it would fuel nationalist claims of a UK that is insensitive to Scotland’s needs.

“The new prime minister faces considerable challenges, and the future of the UK is high on the list.”

With Boris Johnson saying he is ready to embrace no-deal in order to achieve Brexit by October 31 - a point he made again in his first Downing Street address as Prime Minister - the SNP Westminster leader Ian Blackford told Radio 4: “I think as it stands today he could be the last prime minister of the United Kingdom.”