First Minister Nicola Sturgeon has welcomed Scotland's "unequivocal" vote to stay in Europe after all 32 local authorities delivered a vote for Remain.

But despite the vote, the country still faces having to exit the European Union (EU), after the Leave campaign edged ahead across the UK.

The result means Ms Sturgeon will now come under pressure to call a second independence referendum.

The SNP manifesto for May's Scottish Parliament election said there should be another ballot if there was a "significant and material" change in circumstances from the 2014 vote, such as Scotland being taken out of the EU against its will.

After all the results north of the border were declared, Ms Sturgeon said: "Scotland has delivered a strong, unequivocal vote to remain in the EU, and I welcome that endorsement of our European status.

Read more: David Cameron has quit as Prime Minister after UK votes to leave the EU

"And while the overall result remains to be declared, the vote here makes clear that the people of Scotland see their future as part of the European Union."

She added: "Scotland has contributed significantly to the Remain vote across the UK. That reflects the positive campaign the SNP fought, which highlighted the gains and benefits of our EU membership, and people across Scotland have responded to that positive message.

"We await the final UK-wide result, but Scotland has spoken - and spoken decisively."

Former first minister Alex Salmond told the BBC: "Scotland looks like it is going to vote solidly Remain. If there was a Leave vote in England, dragging us out the EU, I'm quite certain Nicola Sturgeon would implement the SNP manifesto."

Almost two thirds (62 per cent) of Scots who voted had backed staying part of the EU, with 38 per cent opting for Brexit.

Holyrood External Affairs Secretary Fiona Hylsop warned that a decision by the UK to quit Europe would have "consequences".

She told the BBC: "Scotland clearly and decisively voted to remain part of the European Union, 62 to 38 with an increased turn out form the Scottish Parliament elections barely six weeks ago.

Read more: JK Rowling: Scotland will see independence after Brexit

"That sends a strong message, it's quite clear we see a different type of politics in Scotland, a different approach to constitutional affairs."

"I think people will be looking very closely at this result and looking at the prospects for Scotland and what is in the best interests of Scotland going forward.

"We're quite clear, the Scottish Government will protect Scotland's interests whatever the circumstances and we intend to do that."

How the Scottish Government will do that "will depend on exactly what the result is", Ms Hyslop added.

"But we're very clear, the Scottish people have spoken. Their interests are about maintaining that membership, they are interested in maintaining our relations with Europe. We have to find the means with which we can do that."

While she said there is "some way to go in determining the mechanism of doing that", she said: "Decisions have consequences and if the United Kingdom has made a decision against the interests of the Scottish people that will have consequences."

As a victory for the Leave campaign appeared increasingly likely, the Scottish Greens launched an online petition calling on Holyrood to "examine and exhaust every option for continuing Scotland's close ties with Europe".

Scottish Green co-convener Patrick Harvie said: "It's devastating to see that the deceitful, manipulative and at times downright racist Brexit campaign has succeeded south of the border, and looks set to tear up the many benefits of EU membership and play fast and loose with our economic future.

"The Leave campaign claimed to be defending democracy, but they now propose to remove the rights of EU citizenship from Scotland regardless of the way people living here voted.

"Scotland must keep open every option for protecting ourselves from this threat. The Scottish Parliament and Government must be represented in the negotiations about what comes next. A cross-party plan of action should be sought, so we can defend our rights as EU citizens."

Harry Potter author JK Rowling, who previously came out in support of the Remain campaign, tweeted: "Scotland will seek independence now. (David) Cameron's legacy will be breaking up two unions. Neither needed to happen."

Scottish Liberal Democrat leader Willie Rennie MSP said: "I am angry that we have lost our place in Europe. It is bad for our country and the people who live here. It means cutting our ties with our biggest economic market despite the consequences for trade, business, jobs and incomes.

"It means we are turning our back on co-operating with our closest neighbours on security, peace, the environment and workers' rights."

Mr Rennie said he is "embarrassed by the signal it sends to the rest of Europe and the rest of the world", and added: "Be in no doubt that this decision sets our country back."

He said: "Now the Prime Minister should act with caution. He should not head towards the exit door with haste. The country needs stability and time to come to terms with this result before any steps are taken."

Before the referendum the leaders of all five political parties at Holyrood issued a joint statement calling on Scots to vote Remain.

After the result, Scottish Labour leader Kezia Dugdale said there would be "difficult times ahead".

She tweeted: "Tories took a huge gamble with our future and they've lost. Now they need to act to protect our economy.

"In Scotland, it's clear we want to work together. 1.6 million voted to remain in EU, 2 million voted to stay in UK just 18 months ago."

With voters in Northern Ireland and London also backing staying in Europe, the Electoral Reform Society (ERS) called for a constitutional convention to be set up to consider the next steps.

ERS Scotland director Rory Scothorne said: "We are clearly in uncharted political waters here. The Governments of the UK should very quickly issue a joint holding statement on how they might plot a course through this turbulent constitutional time."

He added: "This vote poses big questions about the constitution of the UK as a political entity going forward, with the UK's nations divided. Without action now we risk descending into constitutional chaos, and it's vital that the public are involved in the discussions that lie ahead about the ramifications of this split vote.

"It's more clear than ever that we need a citizen-led constitutional convention to bring citizens and politicians together to seriously discuss the democratic future of the UK.

"The constitutional changes we've seen in recent years have been piecemeal and ad hoc - it's time for some joined-up deliberation and to let the public in.

"All parties across the UK should now come together to discuss how best to start this essential process."