IT is with an enormous sense of relief that I am able to write this with the UK still a member of the EU. Thankfully, we avoided the catastrophic impact of crashing out of the EU last week without a deal.

It’s hugely welcome that the European Union rescued the UK from the disaster of an immediate hard Brexit by granting an extension to the Article 50 period and moving the proposed exit date from April 12 to October 31.

But however welcome this breathing space undoubtedly is, it must be used constructively by the UK government – we cannot afford more time-wasting and uncertainty.

Scotland’s overwhelming vote to remain in the EU and the will of the Scottish Parliament – as well as all compromise attempts made by the Scottish Government - have so far been completely disregarded by the Prime Minister and her government. That must surely now change, a view I made clear to Theresa May in a letter last week.

The talks that the UK government is having with the Labour Party must now be opened up to include other parties, the devolved administrations and wider business and civic society.

Even more crucially, if these talks are to stand any real chance of succeeding, the Prime Minister must urgently change her approach. In particular, she must recognise how essential it is for Scotland, as an absolute minimum, to stay in the Single Market and retain freedom of movement.

Beyond this, it is now imperative for any withdrawal deal agreed by Westminster to be put back to the people in another referendum, with the option of remaining in the EU on the ballot paper. The extension allows the time to do this and preparations should be made without delay.

Thankfully, the Scottish Government has not had to spend the past few days worrying about we how we secure food and medicine supplies. That gives us the chance to reflect, instead, on how we have all ended up in this mess.

We are in this dire situation because of a chain of events that have been spectacularly mishandled by the Tories at virtually every step of the way.

They instigated a referendum, without any effort to define what leaving the EU would mean in practice. They ignored the issue of the Irish border, and since the vote, they have spent too much time appeasing hard line Brexiteers instead of seeking compromise.

Most recently, Theresa May asked the EU to delay Brexit until the end of June, with absolutely no plan about what she could achieve to break the deadlock in that time.

Her talks with Labour stalled because, as has been experienced by the SNP and the Scottish Government for the past two years, she is inexplicably and inflexibly tied to her red-lines and has shown no willingness to compromise whatsoever.

From start to finish the Tories’ approach to Brexit has been characterised by complacency, ineptitude and inflexibility, and as a result the UK is experiencing the greatest failure of governance in any of our lifetimes.

All the while, we have seen solidarity and a common purpose from the EU and its member states.

Indeed, it is notable that of the 27 independent countries that decided the UK’s future last week, twelve of them are smaller than or similar in size to Scotland.

Scotland should be a thriving and driving force within the EU. Instead we face being forced to the margins.

In fact, one of the greatest ironies of the UK’s attempts to leave the EU in a quest to ‘take back control’ is that we have instead seen the power that small, independent countries actually have within the EU.

Whilst most of the powers required to tackle the effects of Brexit remain reserved to Westminster, the Scottish Government is doing all it can to protect Scotland.

That includes working to ensure that EU citizens living here are supported to continue their lives in Scotland.

The fact the Scottish Government cannot guarantee the rights of EU citizens and enable them to stay is incredibly frustrating. They have endured years of careless indecision on what the future holds for them. For me, meeting the many people embroiled in such uncertainty has been one of the hardest parts of dealing with Brexit.

It’s vital for EU citizens to know they are welcome and will be supported to stay in Scotland.

This is why we recently launched the ‘Stay in Scotland’ package of support, designed to provide guidance for those applying to stay. It includes funding for community-based support across the country, an enhanced advice service within Citizens Advice Scotland for people with complex needs, and a toolkit for employers so they too can support employees wishing to remain in Scotland.

The UK government continues to follow a path which will make its citizens poorer and reduce its standing in the world.

I will continue to do everything in my power to ensure Scotland’s interests are protected. The question is, will the UK government finally listen, or will they continue to ride roughshod over Scotland’s democratic will and our future prosperity?