Scotland wants to keep its close ties to EU following Brexit
Nicola Sturgeon has said she will seek to enter into "immediate discussions" with Brussels to "protect Scotland's place in the EU".
The Scottish First Minister said her cabinet has agreed to being work on legislation would allow for the option of a second independence referendum.
Scotland voted 62 to 38% to remain in the EU in Thursday's referendum, sharply contrasting with Britain's overall 52-48% vote to leave.
Ms Sturgeon said "a second independence referendum is clearly an option that requires to be on the table and is very much on the table. To ensure that that option is a deliverable one within the required timetable, steps will be taken now to ensure that the necessary legislation is in place."
The governing Scottish National Party will establish an advisory panel with experts to advise them on legal, financial and diplomatic matters as they seeks to continue Scotland's membership following the Brexit vote.
Opposition parties in Scotland have warned against rushing into a second independence referendum, after the first was rejected 55 to 45% in 2014.
Scottish Conservative leader Ruth Davidson said the 1.6 million votes cast in favour of remaining in the EU "do not wipe away the two million votes that we cast less than two years ago".
Scottish Labour leader Kezia Dugdale said fundamental questions asked during the independence campaign, such as those over currency, remained unanswered.