The Scottish Government is carrying out "appropriate planning" to prepare for the economic shock that a vote to leave the European Union (EU) would cause, the First Minister has said.
Nicola Sturgeon said while she hoped next week's referendum would not result in the UK quitting the EU, it is her "duty is to seek to protect Scotland's interests in all circumstances".
She confirmed to MSPs at Holyrood she is "ensuring that appropriate planning for all eventualities is being undertaken by the Scottish Government".
The SNP leader also repeated her warning that if the vote on June 23 results in Scotland being removed from the EU "against our democratically-expressed will", this could result in a second Scottish independence referendum.
Polls in Scotland have continued to show a majority of people want the UK to remain in Europe while more recent polls across the UK have put the Leave campaign in the lead.
The First Minister said that "if Scotland faces the prospect of being taken out of the European Union against our democratically-expressed will, then all options to protect our relationship with Europe and the European Union will require to be considered".
She spoke out after being questioned by Scottish Labour leader Kezia Dugdale on the impact the EU referendum could have on Scotland.
Ms Dugdale, who raised the issue at First Minister's Questions, warned that "sudden shocks" such as a vote for Brexit would hit the country's economy and would also "have a damaging impact on our ability to fund public services".
She asked Ms Sturgeon what contingency planning is being carried out in case there is a "shock to the UK economy".
Read more: Nicola Sturgeon brands Ukip Leave campaign's Breaking Point 'disgusting'
More than 300,000 jobs in Scotland are linked either directly or indirectly to the country's EU membership, the First Minister told MSPs.
She added: "More than 40% of Scotland's international exports go to countries within the single market, and of the more than 2,000 foreign-owned companies in Scotland, 40% are owned by firms that are based in other European countries.
"These are all positive reasons related to the jobs and livelihoods of thousands of people across Scotland for my conclusion that Scotland's continuing relationship with Europe is absolutely vital."
Ms Dugdale also stressed the referendum on Europe "is about securing hundreds of thousands of jobs, protecting the rights of workers and showing the world the type of country we want to be".
The Labour leader highlighted her support "for the principle of working together with the other nations of the world" to tackle global issues such as climate change, terrorism and the refugee crisis.
Ms Sturgeon agreed with that "very strongly", telling the chamber: "I believe passionately that Scotland should be an independent country and I very much hope in the near future we will be an independent country.
Read more: Former SNP leader 'exasperated' at party's 'confused' EU stance
"But I also believe very strongly that in the modern, interdependent world we live in, that independent countries must work together to tackle the issues that no country can deal with on its own, and that does include issues like climate change, the refugee crisis and tackling terrorism.
"Independent countries working together on these issues make all of us stronger and safer."
Pro-Brexit Conservative MSP Margaret Mitchell later raised a point of order challenging whether the exchanges had breached the Scottish Parliament's purdah rules during the referendum period, which prevent MSPs from using public resources to influence the outcome.
She said: "If they have been breached, what opportunity will there be to point out the unfettered free movement of people will deeply damage the economy and our public services, and to point out that as the fifth-largest economy in the world and a talented and innovative people the UK is more than capable of surviving outside the EU, and in fact it has been Nato and the UN which has preserved our security, not the EU?"
Presiding officer Ken Macintosh told MSPs the decision had been taken by Holyrood's business bureau, acting on legal advice, that parliamentary resources should not be used to promote one side or the other during the referendum.
He said: "I listened to both the questions and the answers very carefully. It is my judgement that they did not breach that agreement and they did not take a side on either side of the referendum issue.
"They did not use parliamentary resources to promote one side of the argument."
He was challenged by Labour MSP Neil Findlay, who pointed out parliamentary resources included the use of power in the chamber and the Official Report, the written record of what is said in the parliament.
Mr Findlay said: "I think we need absolute clarity on this because it is very important."
Mr Macintosh responded: "The use of the Official Report to report our proceedings is a use of parliamentary resources.
"In this particular case I did not judge that either the questions or the answers were an abuse of those resources."
Why are you making commenting on The Herald only available to subscribers?
It should have been a safe space for informed debate, somewhere for readers to discuss issues around the biggest stories of the day, but all too often the below the line comments on most websites have become bogged down by off-topic discussions and abuse.
heraldscotland.com is tackling this problem by allowing only subscribers to comment.
We are doing this to improve the experience for our loyal readers and we believe it will reduce the ability of trolls and troublemakers, who occasionally find their way onto our site, to abuse our journalists and readers. We also hope it will help the comments section fulfil its promise as a part of Scotland's conversation with itself.
We are lucky at The Herald. We are read by an informed, educated readership who can add their knowledge and insights to our stories.
That is invaluable.
We are making the subscriber-only change to support our valued readers, who tell us they don't want the site cluttered up with irrelevant comments, untruths and abuse.
In the past, the journalist’s job was to collect and distribute information to the audience. Technology means that readers can shape a discussion. We look forward to hearing from you on heraldscotland.com
Comments & Moderation
Readers’ comments: You are personally liable for the content of any comments you upload to this website, so please act responsibly. We do not pre-moderate or monitor readers’ comments appearing on our websites, but we do post-moderate in response to complaints we receive or otherwise when a potential problem comes to our attention. You can make a complaint by using the ‘report this post’ link . We may then apply our discretion under the user terms to amend or delete comments.
Post moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours.
Read the rules here