Last ditch talks are going on between the UK and Scottish governments in a bid to persuade Nicola Sturgeon’s Holyrood administration to ditch its opposition to the EU Withdrawal Bill, the Brexit Secretary has revealed.

David Davis said he was still hopeful an agreement could be reached with SNP ministers, adding he believed they had come “quite close” to breaking the deadlock.

He spoke after the Scottish First Minister rejected changes being made to the Bill – despite the Welsh Government signing up to the compromise proposals.

The two devolved administrations had been working together to prevent a “power grab”, after the legislation set out plans for some powers to be returned to Westminster – instead of Edinburgh or Cardiff – so common frameworks could be put in place across the UK.

With no deal having been reached with the Scottish Government, SNP MP Joanna Cherry warned it was “a very real possibility” that the Scottish Parliament would not give its formal consent to the EU Withdrawal Bill.

While this would not stop the UK Government from bringing in the legislation, it raises the prospect of a deepening rift between Westminster and Holyrood if the Bill has to be forced through against the wishes of MSPs.

Mr Davis told MPs on the House of Commons Exiting the EU Committee that talks were still going on with the Scottish Government.

He said: “I was slightly disappointed we didn’t get agreement with the Scottish Government. I thought we got quite close.

“The Welsh Government have essentially agreed with the changes we have proposed and we are still talking to the Scottish Government and we will be up until five o’clock this evening, when the last possible time for laying the amendment is.

“I hope we can find a mechanism for getting agreement between us still.”

The changes the UK Government are making will see a “sunset clause” introduced to the legislation, so that devolved powers returned to Westminster do not stay there permanently.

Even with this, the Scottish Government said that Holyrood’s powers could be restricted for up to seven years by the UK.

Ms Cherry said: “It is a very real possibility now that the Scottish Parliament will not give its legislative consent to the Withdrawal Bill.

“It seems to me there are three options. It will either stop the bill in its tracks or will delay its progress, or the UK Government could simply ignore the issue of consent and ride roughshod over the wishes of the Scottish Parliament and proceed.”

Mr Davis declined to speculate on which route the Government would take in that case, telling Ms Cherry: “I prefer to continue our discussions with the Scottish Government today and, if need be, thereafter.”

Scottish Brexit Minister Mike Russell told MSPs on Tuesday the “key sticking point” in reaching a deal was “clause 11 and the insistence of the UK Government on its right to take control of devolved powers”.

Welsh Finance Secretary Mark Drakeford said he had agreed a deal after “London has changed its position so that all powers and policy areas rest in Cardiff, unless specified to be temporarily held by the UK Government”.

He added: “These will be areas where we all agree common, UK-wide rules are needed for a functioning UK internal market.

Mr Drakeford praised “London’s willingness to listen to our concerns and enter serious negotiations”.

Scottish Conservative constitution spokesman Adam Tomkins said the deal with Wales left the Scottish First Minister “alone and isolated in her belligerence”.

He said on Twitter: “Delighted that agreement has been reached between UK and Welsh Govts on legislating for Brexit compatibly with devolution. Unsurprised that the wretched SNP would rather manufacture further grievance than get on board with the deal. A good day for the UK; a bad day for the SNP.”